#include "third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client.h"
#include <vector>
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/loader/throttling_url_loader.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
#include "third_party/blink/public/platform/resource_load_info_notifier_wrapper.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/resource_request_sender.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
namespace blink {
namespace {
constexpr size_t kDataPipeCapacity = …;
class MockResourceRequestSender : public ResourceRequestSender { … };
std::string ReadOneChunk(mojo::ScopedDataPipeConsumerHandle* handle) { … }
std::string GetRequestPeerContextBody(
MockResourceRequestSender::Context* context) { … }
class TestBackForwardCacheLoaderHelper : public BackForwardCacheLoaderHelper { … };
}
class WebMojoURLLoaderClientTest : public ::testing::Test,
public network::mojom::URLLoaderFactory,
public ::testing::WithParamInterface<bool> { … };
TEST_P(WebMojoURLLoaderClientTest, OnReceiveResponse) { … }
TEST_P(WebMojoURLLoaderClientTest, ResponseBody) { … }
TEST_P(WebMojoURLLoaderClientTest, OnReceiveRedirect) { … }
TEST_P(WebMojoURLLoaderClientTest, OnReceiveResponseWithCachedMetadata) { … }
TEST_P(WebMojoURLLoaderClientTest, OnTransferSizeUpdated) { … }
TEST_P(WebMojoURLLoaderClientTest, OnCompleteWithResponseBody) { … }
TEST_P(WebMojoURLLoaderClientTest, OnCompleteShouldBeTheLastMessage) { … }
TEST_P(WebMojoURLLoaderClientTest, CancelOnReceiveResponse) { … }
TEST_P(WebMojoURLLoaderClientTest, Defer) { … }
TEST_P(WebMojoURLLoaderClientTest, DeferWithResponseBody) { … }
TEST_P(WebMojoURLLoaderClientTest,
DeferredAndDeferredWithBackForwardCacheTransitions) { … }
TEST_P(WebMojoURLLoaderClientTest,
DeferredWithBackForwardCacheStoppedDeferringBeforeClosing) { … }
TEST_P(WebMojoURLLoaderClientTest,
DeferredWithBackForwardCacheLongResponseBody) { … }
TEST_P(WebMojoURLLoaderClientTest, DeferWithTransferSizeUpdated) { … }
TEST_P(WebMojoURLLoaderClientTest, SetDeferredDuringFlushingDeferredMessage) { … }
TEST_P(WebMojoURLLoaderClientTest,
SetDeferredDuringFlushingDeferredMessageOnTransferSizeUpdated) { … }
INSTANTIATE_TEST_SUITE_P(…);
}