| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/precache/content/precache_manager.h" | 5 #include "components/precache/content/precache_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 switches::kPrecacheManifestURLPrefix, kManifestURLPrefix); | 149 switches::kPrecacheManifestURLPrefix, kManifestURLPrefix); |
| 150 | 150 |
| 151 // Make the fetch of the precache configuration settings fail. Precaching | 151 // Make the fetch of the precache configuration settings fail. Precaching |
| 152 // should still complete normally in this case. | 152 // should still complete normally in this case. |
| 153 factory_.SetFakeResponse(GURL(kConfigURL), "", | 153 factory_.SetFakeResponse(GURL(kConfigURL), "", |
| 154 net::HTTP_INTERNAL_SERVER_ERROR, | 154 net::HTTP_INTERNAL_SERVER_ERROR, |
| 155 net::URLRequestStatus::FAILED); | 155 net::URLRequestStatus::FAILED); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Must be declared first so that it is destroyed last. | 158 // Must be declared first so that it is destroyed last. |
| 159 content::TestBrowserContext browser_context_; |
| 159 content::TestBrowserThreadBundle test_browser_thread_bundle_; | 160 content::TestBrowserThreadBundle test_browser_thread_bundle_; |
| 160 content::TestBrowserContext browser_context_; | |
| 161 PrecacheManagerUnderTest precache_manager_; | 161 PrecacheManagerUnderTest precache_manager_; |
| 162 TestURLFetcherCallback url_callback_; | 162 TestURLFetcherCallback url_callback_; |
| 163 net::FakeURLFetcherFactory factory_; | 163 net::FakeURLFetcherFactory factory_; |
| 164 TestPrecacheCompletionCallback precache_callback_; | 164 TestPrecacheCompletionCallback precache_callback_; |
| 165 testing::NiceMock<MockHistoryService> history_service_; | 165 testing::NiceMock<MockHistoryService> history_service_; |
| 166 base::HistogramTester histograms_; | 166 base::HistogramTester histograms_; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 TEST_F(PrecacheManagerTest, StartAndFinishPrecaching) { | 169 TEST_F(PrecacheManagerTest, StartAndFinishPrecaching) { |
| 170 EXPECT_FALSE(precache_manager_.IsPrecaching()); | 170 EXPECT_FALSE(precache_manager_.IsPrecaching()); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 expected_histogram_count_map["Precache.Saved"] += 2; | 429 expected_histogram_count_map["Precache.Saved"] += 2; |
| 430 | 430 |
| 431 base::MessageLoop::current()->RunUntilIdle(); | 431 base::MessageLoop::current()->RunUntilIdle(); |
| 432 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), | 432 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), |
| 433 ContainerEq(expected_histogram_count_map)); | 433 ContainerEq(expected_histogram_count_map)); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace | 436 } // namespace |
| 437 | 437 |
| 438 } // namespace precache | 438 } // namespace precache |
| OLD | NEW |