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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 bool IsInControlGroup() const override { return control_group_; } | 140 bool IsInControlGroup() const override { return control_group_; } |
141 bool IsPrecachingAllowed() const override { return true; } | 141 bool IsPrecachingAllowed() const override { return true; } |
142 void SetInControlGroup(bool in_control_group) { | 142 void SetInControlGroup(bool in_control_group) { |
143 control_group_ = in_control_group; | 143 control_group_ = in_control_group; |
144 } | 144 } |
145 | 145 |
146 private: | 146 private: |
147 bool control_group_; | 147 bool control_group_; |
148 }; | 148 }; |
149 | 149 |
150 } // namespace | |
Raj
2016/07/06 18:28:23
Moving PrecacheManagerTest out of anonymous namesp
| |
151 | |
150 class PrecacheManagerTest : public testing::Test { | 152 class PrecacheManagerTest : public testing::Test { |
151 public: | 153 public: |
152 PrecacheManagerTest() | 154 PrecacheManagerTest() |
153 : factory_(nullptr, | 155 : factory_(nullptr, |
154 base::Bind(&TestURLFetcherCallback::CreateURLFetcher, | 156 base::Bind(&TestURLFetcherCallback::CreateURLFetcher, |
155 base::Unretained(&url_callback_))) {} | 157 base::Unretained(&url_callback_))) {} |
156 | 158 |
157 ~PrecacheManagerTest() { | 159 ~PrecacheManagerTest() { |
158 // precache_manager_'s constructor releases a PrecacheDatabase and deletes | 160 // precache_manager_'s constructor releases a PrecacheDatabase and deletes |
159 // it on the DB thread. PrecacheDatabase already has a pending Init call | 161 // it on the DB thread. PrecacheDatabase already has a pending Init call |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 1000, true); | 518 1000, true); |
517 expected_histogram_count_map["Precache.Latency.NonPrefetch"] += 2; | 519 expected_histogram_count_map["Precache.Latency.NonPrefetch"] += 2; |
518 expected_histogram_count_map["Precache.Latency.NonPrefetch.NonTopHosts"] += 2; | 520 expected_histogram_count_map["Precache.Latency.NonPrefetch.NonTopHosts"] += 2; |
519 expected_histogram_count_map["Precache.Saved"] += 2; | 521 expected_histogram_count_map["Precache.Saved"] += 2; |
520 | 522 |
521 base::RunLoop().RunUntilIdle(); | 523 base::RunLoop().RunUntilIdle(); |
522 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), | 524 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), |
523 ContainerEq(expected_histogram_count_map)); | 525 ContainerEq(expected_histogram_count_map)); |
524 } | 526 } |
525 | 527 |
526 } // namespace | |
527 | |
528 } // namespace precache | 528 } // namespace precache |
OLD | NEW |