| 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 <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 class PrecacheManagerTest : public testing::Test { | 135 class PrecacheManagerTest : public testing::Test { |
| 136 public: | 136 public: |
| 137 PrecacheManagerTest() | 137 PrecacheManagerTest() |
| 138 : precache_manager_(&browser_context_), | 138 : precache_manager_(&browser_context_), |
| 139 factory_(NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher, | 139 factory_(NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher, |
| 140 base::Unretained(&url_callback_))) {} | 140 base::Unretained(&url_callback_))) {} |
| 141 | 141 |
| 142 protected: | 142 protected: |
| 143 virtual void SetUp() override { | 143 void SetUp() override { |
| 144 base::StatisticsRecorder::Initialize(); | 144 base::StatisticsRecorder::Initialize(); |
| 145 | 145 |
| 146 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 146 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 147 switches::kPrecacheConfigSettingsURL, kConfigURL); | 147 switches::kPrecacheConfigSettingsURL, kConfigURL); |
| 148 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 148 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 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), "", |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 kCurrentTime, 1000, true); | 349 kCurrentTime, 1000, true); |
| 350 expected_histogram_count_map["Precache.Saved"] += 2; | 350 expected_histogram_count_map["Precache.Saved"] += 2; |
| 351 | 351 |
| 352 base::MessageLoop::current()->RunUntilIdle(); | 352 base::MessageLoop::current()->RunUntilIdle(); |
| 353 EXPECT_EQ(expected_histogram_count_map, GetHistogramCountMap()); | 353 EXPECT_EQ(expected_histogram_count_map, GetHistogramCountMap()); |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace | 356 } // namespace |
| 357 | 357 |
| 358 } // namespace precache | 358 } // namespace precache |
| OLD | NEW |