#include "services/network/prefetch_url_loader_client.h"
#include <stdint.h>
#include <type_traits>
#include <utility>
#include "base/functional/bind.h"
#include "base/ranges/algorithm.h"
#include "base/task/thread_pool.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "net/base/isolation_info.h"
#include "net/base/network_isolation_key.h"
#include "net/cookies/site_for_cookies.h"
#include "net/http/http_status_code.h"
#include "net/url_request/redirect_info.h"
#include "net/url_request/referrer_policy.h"
#include "services/network/prefetch_cache.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/test/mock_url_loader_client.h"
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace network {
namespace {
_;
Eq;
InSequence;
Invoke;
IsTrue;
MockFunction;
NotNull;
Optional;
Pointee;
StrictMock;
WithArg;
constexpr uint64_t kTestCurrentPosition = …;
constexpr uint64_t kTestTotalSize = …;
constexpr int32_t kTransferSizeDiff = …;
constexpr size_t kDataPipeCapacity = …;
constexpr char kResponseBody[] = …;
constexpr size_t kBigBufferSize = …;
GURL TestURL() { … }
url::Origin TestOrigin() { … }
net::IsolationInfo TestIsolationInfo() { … }
net::NetworkIsolationKey TestNIK() { … }
ResourceRequest TestRequest() { … }
mojom::EarlyHintsPtr TestEarlyHints() { … }
mojom::URLResponseHeadPtr TestURLResponseHead() { … }
MATCHER(URLResponseHeadIsOk, "URLResponseHead is ok") { … }
mojo::ScopedDataPipeConsumerHandle TestDataPipeConsumer() { … }
void CheckDataPipeContents(mojo::ScopedDataPipeConsumerHandle consumer) { … }
mojo_base::BigBuffer TestBigBuffer() { … }
MATCHER(BigBufferHasExpectedContents,
"does the BigBuffer have the right contents") { … }
net::RedirectInfo TestRedirectInfo() { … }
bool Equals(const net::SiteForCookies& lhs, const net::SiteForCookies& rhs) { … }
MATCHER(EqualsTestRedirectInfo, "equals test RedirectInfo") { … }
URLLoaderCompletionStatus TestURLLoaderCompletionStatus() { … }
MATCHER(URLLoaderCompletionStatusIsOk, "URLLoaderCompletionStatus is ok") { … }
void CallAllMojoMethods(mojom::URLLoaderClient* client) { … }
void ExpectCallMojoMethods(StrictMock<MockURLLoaderClient>& mock_client) { … }
class DisconnectDetectingReceiver final { … };
class PrefetchURLLoaderClientTest : public ::testing::Test { … };
TEST_F(PrefetchURLLoaderClientTest, Construct) { … }
TEST_F(PrefetchURLLoaderClientTest, RecordAndReplay) { … }
TEST_F(PrefetchURLLoaderClientTest, DelegateDirectly) { … }
TEST_F(PrefetchURLLoaderClientTest, RecordAndDiscard) { … }
TEST_F(PrefetchURLLoaderClientTest, ReplayAfterResponse) { … }
TEST_F(PrefetchURLLoaderClientTest, GetURLLoaderPendingReceiver) { … }
TEST_F(PrefetchURLLoaderClientTest, SetClientRemovesFromCache) { … }
TEST_F(PrefetchURLLoaderClientTest, BadResponseCode) { … }
TEST_F(PrefetchURLLoaderClientTest, BadHeader) { … }
TEST_F(PrefetchURLLoaderClientTest, NoStore) { … }
}
}