Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1828)

Unified Diff: net/http/http_cache_lookup_manager_unittest.cc

Issue 2675343002: Server push cancellation: add NetLogs to track cache lookup transaction (Closed)
Patch Set: fix typo Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_cache_lookup_manager.cc ('k') | net/log/net_log_event_type_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_lookup_manager_unittest.cc
diff --git a/net/http/http_cache_lookup_manager_unittest.cc b/net/http/http_cache_lookup_manager_unittest.cc
index 439aee74a386990afbb66aaf9ff04186392bebb2..2ceebeb64261f049db06eeaee9ccb871d4ba1dad 100644
--- a/net/http/http_cache_lookup_manager_unittest.cc
+++ b/net/http/http_cache_lookup_manager_unittest.cc
@@ -25,7 +25,7 @@ class MockServerPushHelper : public ServerPushDelegate::ServerPushHelper {
public:
explicit MockServerPushHelper(const GURL& url) : request_url_(url) {}
- const GURL& GetURL() override { return request_url_; }
+ const GURL& GetURL() const override { return request_url_; }
MOCK_METHOD0(Cancel, void());
@@ -84,8 +84,7 @@ void PopulateCacheEntry(HttpCache* cache, const GURL& request_url) {
TEST(HttpCacheLookupManagerTest, ServerPushMissCache) {
MockHttpCache mock_cache;
- HttpCacheLookupManager push_delegate(mock_cache.http_cache(),
- NetLogWithSource());
+ HttpCacheLookupManager push_delegate(mock_cache.http_cache());
GURL request_url("http://www.example.com/pushed.jpg");
std::unique_ptr<MockServerPushHelper> push_helper =
@@ -94,7 +93,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushMissCache) {
// Receive a server push and should not cancel the push.
EXPECT_CALL(*push_helper_ptr, Cancel()).Times(0);
- push_delegate.OnPush(std::move(push_helper));
+ push_delegate.OnPush(std::move(push_helper), NetLogWithSource());
base::RunLoop().RunUntilIdle();
// Make sure no network transaction is created.
@@ -105,8 +104,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushMissCache) {
TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) {
MockHttpCache mock_cache;
- HttpCacheLookupManager push_delegate(mock_cache.http_cache(),
- NetLogWithSource());
+ HttpCacheLookupManager push_delegate(mock_cache.http_cache());
GURL request_url("http://www.example.com/pushed.jpg");
std::unique_ptr<MockServerPushHelper> push_helper =
@@ -115,7 +113,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) {
// Receive a server push and should not cancel the push.
EXPECT_CALL(*push_helper_ptr, Cancel()).Times(0);
- push_delegate.OnPush(std::move(push_helper));
+ push_delegate.OnPush(std::move(push_helper), NetLogWithSource());
base::RunLoop().RunUntilIdle();
// Receive another server push for the same url.
@@ -123,7 +121,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) {
base::MakeUnique<MockServerPushHelper>(request_url);
MockServerPushHelper* push_helper_ptr2 = push_helper2.get();
EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(0);
- push_delegate.OnPush(std::move(push_helper2));
+ push_delegate.OnPush(std::move(push_helper2), NetLogWithSource());
base::RunLoop().RunUntilIdle();
// Verify no network transaction is created.
@@ -135,8 +133,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) {
TEST(HttpCacheLookupManagerTest, ServerPushHitCache) {
MockHttpCache mock_cache;
- HttpCacheLookupManager push_delegate(mock_cache.http_cache(),
- NetLogWithSource());
+ HttpCacheLookupManager push_delegate(mock_cache.http_cache());
GURL request_url("http://www.example.com/pushed.jpg");
// Populate the cache entry so that the cache lookup for server push hits.
@@ -157,7 +154,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushHitCache) {
// Receive a server push and should cancel the push.
EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1);
- push_delegate.OnPush(std::move(push_helper));
+ push_delegate.OnPush(std::move(push_helper), NetLogWithSource());
base::RunLoop().RunUntilIdle();
// Make sure no new net layer transaction is created.
@@ -173,8 +170,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushHitCache) {
// send a new lookup transaction and should not be canceled.
TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) {
MockHttpCache mock_cache;
- HttpCacheLookupManager push_delegate(mock_cache.http_cache(),
- NetLogWithSource());
+ HttpCacheLookupManager push_delegate(mock_cache.http_cache());
GURL request_url("http://www.example.com/pushed.jpg");
// Populate the cache entry so that the cache lookup for server push hits.
@@ -195,7 +191,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) {
// Receive a server push and should cancel the push eventually.
EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1);
- push_delegate.OnPush(std::move(push_helper));
+ push_delegate.OnPush(std::move(push_helper), NetLogWithSource());
std::unique_ptr<MockServerPushHelper> push_helper2 =
base::MakeUnique<MockServerPushHelper>(request_url);
@@ -203,7 +199,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) {
// Receive another server push and should not cancel the push.
EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(0);
- push_delegate.OnPush(std::move(push_helper2));
+ push_delegate.OnPush(std::move(push_helper2), NetLogWithSource());
base::RunLoop().RunUntilIdle();
@@ -218,8 +214,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) {
// Test the server push lookup is based on the full url.
TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) {
MockHttpCache mock_cache;
- HttpCacheLookupManager push_delegate(mock_cache.http_cache(),
- NetLogWithSource());
+ HttpCacheLookupManager push_delegate(mock_cache.http_cache());
GURL request_url("http://www.example.com/pushed.jpg?u=0");
GURL request_url2("http://www.example.com/pushed.jpg?u=1");
@@ -241,7 +236,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) {
// Receive a server push and should cancel the push eventually.
EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1);
- push_delegate.OnPush(std::move(push_helper));
+ push_delegate.OnPush(std::move(push_helper), NetLogWithSource());
// Run until the lookup transaction finishes for the first server push.
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, mock_cache.network_layer()->transaction_count());
@@ -257,7 +252,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) {
MockServerPushHelper* push_helper_ptr2 = push_helper2.get();
EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(1);
- push_delegate.OnPush(std::move(push_helper2));
+ push_delegate.OnPush(std::move(push_helper2), NetLogWithSource());
// Run until the lookup transaction finishes for the second server push.
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, mock_cache.network_layer()->transaction_count());
@@ -275,7 +270,7 @@ TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) {
MockServerPushHelper* push_helper_ptr3 = push_helper3.get();
EXPECT_CALL(*push_helper_ptr3, Cancel()).Times(0);
- push_delegate.OnPush(std::move(push_helper3));
+ push_delegate.OnPush(std::move(push_helper3), NetLogWithSource());
base::RunLoop().RunUntilIdle();
// Make sure no new net layer transaction is created.
« no previous file with comments | « net/http/http_cache_lookup_manager.cc ('k') | net/log/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698