| 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 <memory> | 10 #include <memory> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 bool was_on_done_called() const { | 120 bool was_on_done_called() const { |
| 121 return was_on_done_called_; | 121 return was_on_done_called_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 bool was_on_done_called_; | 125 bool was_on_done_called_; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class PrecacheManagerUnderTest : public PrecacheManager { | 128 class PrecacheManagerUnderTest : public PrecacheManager { |
| 129 public: | 129 public: |
| 130 PrecacheManagerUnderTest( | 130 PrecacheManagerUnderTest(content::BrowserContext* browser_context, |
| 131 content::BrowserContext* browser_context, | 131 const syncer::SyncService* const sync_service, |
| 132 const sync_driver::SyncService* const sync_service, | 132 const history::HistoryService* const history_service, |
| 133 const history::HistoryService* const history_service, | 133 const base::FilePath& db_path, |
| 134 const base::FilePath& db_path, | 134 std::unique_ptr<PrecacheDatabase> precache_database) |
| 135 std::unique_ptr<PrecacheDatabase> precache_database) | 135 : PrecacheManager(browser_context, |
| 136 : PrecacheManager( | 136 sync_service, |
| 137 browser_context, sync_service, history_service, | 137 history_service, |
| 138 db_path, std::move(precache_database)), | 138 db_path, |
| 139 control_group_(false) { | 139 std::move(precache_database)), |
| 140 } | 140 control_group_(false) {} |
| 141 bool IsInExperimentGroup() const override { return !control_group_; } | 141 bool IsInExperimentGroup() const override { return !control_group_; } |
| 142 bool IsInControlGroup() const override { return control_group_; } | 142 bool IsInControlGroup() const override { return control_group_; } |
| 143 bool IsPrecachingAllowed() const override { return true; } | 143 bool IsPrecachingAllowed() const override { return true; } |
| 144 void SetInControlGroup(bool in_control_group) { | 144 void SetInControlGroup(bool in_control_group) { |
| 145 control_group_ = in_control_group; | 145 control_group_ = in_control_group; |
| 146 } | 146 } |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 bool control_group_; | 149 bool control_group_; |
| 150 }; | 150 }; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 expected_histogram_count_map["Precache.Saved"] += 2; | 561 expected_histogram_count_map["Precache.Saved"] += 2; |
| 562 expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2; | 562 expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2; |
| 563 expected_histogram_count_map["Precache.Saved.Freshness"] = 2; | 563 expected_histogram_count_map["Precache.Saved.Freshness"] = 2; |
| 564 | 564 |
| 565 base::RunLoop().RunUntilIdle(); | 565 base::RunLoop().RunUntilIdle(); |
| 566 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), | 566 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), |
| 567 ContainerEq(expected_histogram_count_map)); | 567 ContainerEq(expected_histogram_count_map)); |
| 568 } | 568 } |
| 569 | 569 |
| 570 } // namespace precache | 570 } // namespace precache |
| OLD | NEW |