OLD | NEW |
---|---|
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 InitializeRedirectStat(microsoft.add_redirect_endpoints(), | 433 InitializeRedirectStat(microsoft.add_redirect_endpoints(), |
434 "www.microsoft.com", 10, 0, 0); | 434 "www.microsoft.com", 10, 0, 0); |
435 | 435 |
436 test_host_redirect_data_.clear(); | 436 test_host_redirect_data_.clear(); |
437 test_host_redirect_data_.insert(std::make_pair(bbc.primary_key(), bbc)); | 437 test_host_redirect_data_.insert(std::make_pair(bbc.primary_key(), bbc)); |
438 test_host_redirect_data_.insert( | 438 test_host_redirect_data_.insert( |
439 std::make_pair(microsoft.primary_key(), microsoft)); | 439 std::make_pair(microsoft.primary_key(), microsoft)); |
440 } | 440 } |
441 } | 441 } |
442 | 442 |
443 // Confirm that there's been no shift in the | |
Benoit L
2016/10/21 16:51:20
Thanks for that!
| |
444 // ResourceData_Priority/net::RequestPriority equivalence. | |
445 static_assert(static_cast<int>(net::MINIMUM_PRIORITY) == | |
446 static_cast<int>( | |
447 ResourceData_Priority_REQUEST_PRIORITY_THROTTLED), | |
448 "Database/Net priority mismatch: Minimum"); | |
449 static_assert(static_cast<int>(net::MAXIMUM_PRIORITY) == | |
450 static_cast<int>(ResourceData_Priority_REQUEST_PRIORITY_HIGHEST), | |
451 "Database/Net priority mismatch: Maximum"); | |
452 | |
443 // Tests that the predictor initializes correctly without any data. | 453 // Tests that the predictor initializes correctly without any data. |
444 TEST_F(ResourcePrefetchPredictorTest, LazilyInitializeEmpty) { | 454 TEST_F(ResourcePrefetchPredictorTest, LazilyInitializeEmpty) { |
445 EXPECT_TRUE(predictor_->url_table_cache_->empty()); | 455 EXPECT_TRUE(predictor_->url_table_cache_->empty()); |
446 EXPECT_TRUE(predictor_->host_table_cache_->empty()); | 456 EXPECT_TRUE(predictor_->host_table_cache_->empty()); |
447 EXPECT_TRUE(predictor_->url_redirect_table_cache_->empty()); | 457 EXPECT_TRUE(predictor_->url_redirect_table_cache_->empty()); |
448 EXPECT_TRUE(predictor_->host_redirect_table_cache_->empty()); | 458 EXPECT_TRUE(predictor_->host_redirect_table_cache_->empty()); |
449 } | 459 } |
450 | 460 |
451 // Tests that the history and the db tables data are loaded correctly. | 461 // Tests that the history and the db tables data are loaded correctly. |
452 TEST_F(ResourcePrefetchPredictorTest, LazilyInitializeWithData) { | 462 TEST_F(ResourcePrefetchPredictorTest, LazilyInitializeWithData) { |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1492 net::MEDIUM, false, false); | 1502 net::MEDIUM, false, false); |
1493 predictor_->url_table_cache_->insert( | 1503 predictor_->url_table_cache_->insert( |
1494 std::make_pair(www_google_url.primary_key(), www_google_url)); | 1504 std::make_pair(www_google_url.primary_key(), www_google_url)); |
1495 | 1505 |
1496 urls.clear(); | 1506 urls.clear(); |
1497 EXPECT_TRUE(predictor_->GetPrefetchData(main_frame_url, &urls)); | 1507 EXPECT_TRUE(predictor_->GetPrefetchData(main_frame_url, &urls)); |
1498 EXPECT_THAT(urls, UnorderedElementsAre(GURL(font_url))); | 1508 EXPECT_THAT(urls, UnorderedElementsAre(GURL(font_url))); |
1499 } | 1509 } |
1500 | 1510 |
1501 } // namespace predictors | 1511 } // namespace predictors |
OLD | NEW |