OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/browsing_data/core/counters/browsing_data_counter.h" | 5 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 class BrowsingDataCounterTest : public testing::Test { | 81 class BrowsingDataCounterTest : public testing::Test { |
82 public: | 82 public: |
83 void SetUp() override { | 83 void SetUp() override { |
84 testing::Test::SetUp(); | 84 testing::Test::SetUp(); |
85 pref_service_.reset(new TestingPrefServiceSimple()); | 85 pref_service_.reset(new TestingPrefServiceSimple()); |
86 pref_service_->registry()->RegisterBooleanPref(kTestingDatatypePref, true); | 86 pref_service_->registry()->RegisterBooleanPref(kTestingDatatypePref, true); |
87 pref_service_->registry()->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); | 87 pref_service_->registry()->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); |
88 | 88 |
89 counter_.reset(new MockBrowsingDataCounter()); | 89 counter_.reset(new MockBrowsingDataCounter()); |
90 counter_->Init(pref_service_.get(), base::Bind(&IgnoreResult)); | 90 counter_->Init(pref_service_.get(), |
| 91 browsing_data::ClearBrowsingDataTab::ADVANCED, |
| 92 base::Bind(&IgnoreResult)); |
91 } | 93 } |
92 | 94 |
93 void TearDown() override { | 95 void TearDown() override { |
94 counter_.reset(); | 96 counter_.reset(); |
95 pref_service_.reset(); | 97 pref_service_.reset(); |
96 testing::Test::TearDown(); | 98 testing::Test::TearDown(); |
97 } | 99 } |
98 | 100 |
99 MockBrowsingDataCounter* counter() { return counter_.get(); } | 101 MockBrowsingDataCounter* counter() { return counter_.get(); } |
100 | 102 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 counter()->WaitForResult(); | 189 counter()->WaitForResult(); |
188 | 190 |
189 const std::vector<BrowsingDataCounter::State>& state_transitions = | 191 const std::vector<BrowsingDataCounter::State>& state_transitions = |
190 counter()->GetStateTransitionsForTesting(); | 192 counter()->GetStateTransitionsForTesting(); |
191 DCHECK_EQ(2u, state_transitions.size()); | 193 DCHECK_EQ(2u, state_transitions.size()); |
192 DCHECK_EQ(BrowsingDataCounter::State::RESTARTED, state_transitions[0]); | 194 DCHECK_EQ(BrowsingDataCounter::State::RESTARTED, state_transitions[0]); |
193 DCHECK_EQ(BrowsingDataCounter::State::IDLE, state_transitions[1]); | 195 DCHECK_EQ(BrowsingDataCounter::State::IDLE, state_transitions[1]); |
194 } | 196 } |
195 | 197 |
196 } // namespace browsing_data | 198 } // namespace browsing_data |
OLD | NEW |