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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor_unittest.cc

Issue 2587443002: predictors: Make speculative_prefetch_predictor work with PlzNavigate (Closed)
Patch Set: Reworked Tests Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 5 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 url, net::MEDIUM, content::RESOURCE_TYPE_IMAGE, 1, 1, true); 1324 url, net::MEDIUM, content::RESOURCE_TYPE_IMAGE, 1, 1, true);
1325 URLRequestSummary summary; 1325 URLRequestSummary summary;
1326 EXPECT_TRUE(URLRequestSummary::SummarizeResponse(*request, &summary)); 1326 EXPECT_TRUE(URLRequestSummary::SummarizeResponse(*request, &summary));
1327 EXPECT_EQ(url, summary.resource_url); 1327 EXPECT_EQ(url, summary.resource_url);
1328 EXPECT_EQ(content::RESOURCE_TYPE_IMAGE, summary.resource_type); 1328 EXPECT_EQ(content::RESOURCE_TYPE_IMAGE, summary.resource_type);
1329 EXPECT_TRUE(summary.was_cached); 1329 EXPECT_TRUE(summary.was_cached);
1330 EXPECT_FALSE(summary.has_validators); 1330 EXPECT_FALSE(summary.has_validators);
1331 EXPECT_FALSE(summary.always_revalidate); 1331 EXPECT_FALSE(summary.always_revalidate);
1332 1332
1333 // Navigation_id elements should be unset by default. 1333 // Navigation_id elements should be unset by default.
1334 EXPECT_EQ(-1, summary.navigation_id.render_process_id); 1334 EXPECT_EQ(-1, summary.navigation_id.session_id.id());
1335 EXPECT_EQ(-1, summary.navigation_id.render_frame_id); 1335 EXPECT_EQ(-1, summary.navigation_id.frame_tree_node_id);
1336 EXPECT_EQ(GURL(), summary.navigation_id.main_frame_url); 1336 EXPECT_EQ(GURL(), summary.navigation_id.main_frame_url);
1337 } 1337 }
1338 1338
1339 TEST_F(ResourcePrefetchPredictorTest, SummarizeResponseContentType) { 1339 TEST_F(ResourcePrefetchPredictorTest, SummarizeResponseContentType) {
1340 net::HttpResponseInfo response_info; 1340 net::HttpResponseInfo response_info;
1341 response_info.headers = MakeResponseHeaders( 1341 response_info.headers = MakeResponseHeaders(
1342 "HTTP/1.1 200 OK\n\n" 1342 "HTTP/1.1 200 OK\n\n"
1343 "Some: Headers\n" 1343 "Some: Headers\n"
1344 "Content-Type: image/whatever\n"); 1344 "Content-Type: image/whatever\n");
1345 url_request_job_factory_.set_response_info(response_info); 1345 url_request_job_factory_.set_response_info(response_info);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 net::MEDIUM, false, false); 1551 net::MEDIUM, false, false);
1552 predictor_->url_table_cache_->insert( 1552 predictor_->url_table_cache_->insert(
1553 std::make_pair(www_google_url.primary_key(), www_google_url)); 1553 std::make_pair(www_google_url.primary_key(), www_google_url));
1554 1554
1555 urls.clear(); 1555 urls.clear();
1556 EXPECT_TRUE(predictor_->GetPrefetchData(main_frame_url, &urls)); 1556 EXPECT_TRUE(predictor_->GetPrefetchData(main_frame_url, &urls));
1557 EXPECT_THAT(urls, UnorderedElementsAre(GURL(font_url))); 1557 EXPECT_THAT(urls, UnorderedElementsAre(GURL(font_url)));
1558 } 1558 }
1559 1559
1560 } // namespace predictors 1560 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698