#include "services/network/prefetch_cache.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "net/base/isolation_info.h"
#include "net/base/network_isolation_key.h"
#include "net/base/schemeful_site.h"
#include "net/cookies/site_for_cookies.h"
#include "services/network/prefetch_url_loader_client.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace network {
namespace {
constexpr size_t kMaxSize = …;
GURL TestURL(int index = 0) { … }
url::Origin TestOrigin(int index = 0) { … }
net::IsolationInfo TestIsolationInfo(int index = 0) { … }
net::NetworkIsolationKey TestNIK(int index = 0) { … }
ResourceRequest MakeResourceRequest(GURL url,
net::IsolationInfo isolation_info) { … }
class PrefetchCacheTest : public ::testing::Test { … };
TEST_F(PrefetchCacheTest, Emplace) { … }
TEST_F(PrefetchCacheTest, EmplaceNoNIK) { … }
TEST_F(PrefetchCacheTest, EmplaceTransientNIK) { … }
TEST_F(PrefetchCacheTest, EmplaceFileURL) { … }
TEST_F(PrefetchCacheTest, EmplaceSameURLNIK) { … }
TEST_F(PrefetchCacheTest, EmplaceDifferentURLSameNIK) { … }
TEST_F(PrefetchCacheTest, EmplaceSameURLDifferentNIK) { … }
TEST_F(PrefetchCacheTest, SuccessfulLookup) { … }
TEST_F(PrefetchCacheTest, FailedLookup) { … }
TEST_F(PrefetchCacheTest, EmplaceRespectsMaxSize) { … }
TEST_F(PrefetchCacheTest, ConsumedNodesNoLongerInCache) { … }
TEST_F(PrefetchCacheTest, ConsumedNodesDontCountTowardsCacheSize) { … }
TEST_F(PrefetchCacheTest, ExpiryHappens) { … }
TEST_F(PrefetchCacheTest, TimerSlackIsApplied) { … }
TEST_F(PrefetchCacheTest, SeparatedPrefetchesExpiredSeparatedly) { … }
TEST_F(PrefetchCacheTest, ConsumedPrefetchesAreNotExpired) { … }
}
}