#include "content/common/service_worker/race_network_request_url_loader_client.h"
#include "base/containers/span.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/task_environment.h"
#include "content/common/service_worker/race_network_request_write_buffer_manager.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "net/base/net_errors.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
namespace {
MojoResult CreateDataPipe(mojo::ScopedDataPipeProducerHandle& producer_handle,
mojo::ScopedDataPipeConsumerHandle& consumer_handle) { … }
std::unique_ptr<network::ResourceRequest> CreateRequest() { … }
enum class State { … };
}
OnCommitResponseCallback;
OnCompletedCallback;
class MockServiceWorkerResourceLoader : public ServiceWorkerResourceLoader { … };
class ResponseBodyDataPipeReader { … };
class URLLoaderClientForFetchHandler : public network::mojom::URLLoaderClient,
public ResponseBodyDataPipeReader { … };
class ServiceWorkerRaceNetworkRequestURLLoaderClientTest
: public testing::Test,
public ResponseBodyDataPipeReader { … };
TEST_F(ServiceWorkerRaceNetworkRequestURLLoaderClientTest, Basic) { … }
TEST_F(ServiceWorkerRaceNetworkRequestURLLoaderClientTest,
LargeDataOverBufferSize) { … }
TEST_F(ServiceWorkerRaceNetworkRequestURLLoaderClientTest,
LargeDataOverBufferSize_SlowConsuming) { … }
TEST_F(ServiceWorkerRaceNetworkRequestURLLoaderClientTest,
DataPipeDisconnected) { … }
TEST_F(ServiceWorkerRaceNetworkRequestURLLoaderClientTest,
DataPipeDisconnected_FetchHandler) { … }
TEST_F(ServiceWorkerRaceNetworkRequestURLLoaderClientTest,
NetworkError_AfterInitialResponse) { … }
}