OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "chrome/browser/browsing_data/history_counter.h" | 5 #include "chrome/browser/browsing_data/history_counter.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chrome/browser/history/history_service_factory.h" | 8 #include "chrome/browser/history/history_service_factory.h" |
9 #include "chrome/browser/history/web_history_service_factory.h" | 9 #include "chrome/browser/history/web_history_service_factory.h" |
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
11 #include "chrome/browser/signin/signin_manager_factory.h" | 11 #include "chrome/browser/signin/signin_manager_factory.h" |
12 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "components/browser_sync/browser/profile_sync_service.h" | 15 #include "components/browser_sync/browser/profile_sync_service.h" |
| 16 #include "components/browsing_data/browsing_data_utils.h" |
| 17 #include "components/browsing_data/pref_names.h" |
16 #include "components/history/core/browser/history_service.h" | 18 #include "components/history/core/browser/history_service.h" |
17 #include "components/history/core/browser/web_history_service.h" | 19 #include "components/history/core/browser/web_history_service.h" |
18 #include "components/history/core/test/fake_web_history_service.h" | 20 #include "components/history/core/test/fake_web_history_service.h" |
19 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
20 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 22 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
21 #include "components/signin/core/browser/signin_manager.h" | 23 #include "components/signin/core/browser/signin_manager.h" |
22 #include "net/http/http_status_code.h" | 24 #include "net/http/http_status_code.h" |
23 #include "url/gurl.h" | 25 #include "url/gurl.h" |
24 | 26 |
25 namespace { | 27 namespace { |
26 | 28 |
27 class HistoryCounterTest : public SyncTest { | 29 class HistoryCounterTest : public SyncTest { |
28 public: | 30 public: |
29 HistoryCounterTest() : SyncTest(SINGLE_CLIENT) { | 31 HistoryCounterTest() : SyncTest(SINGLE_CLIENT) { |
30 // TODO(msramek): Only one of the test cases, RestartOnSyncChange, is a Sync | 32 // TODO(msramek): Only one of the test cases, RestartOnSyncChange, is a Sync |
31 // integration test. Extract it and move it to the rest of integration tests | 33 // integration test. Extract it and move it to the rest of integration tests |
32 // in chrome/browser/sync/test/integration/. Change this class back to | 34 // in chrome/browser/sync/test/integration/. Change this class back to |
33 // InProcessBrowserTest. | 35 // InProcessBrowserTest. |
34 } | 36 } |
35 | 37 |
36 ~HistoryCounterTest() override {}; | 38 ~HistoryCounterTest() override {}; |
37 | 39 |
38 void SetUpOnMainThread() override { | 40 void SetUpOnMainThread() override { |
39 time_ = base::Time::Now(); | 41 time_ = base::Time::Now(); |
40 service_ = HistoryServiceFactory::GetForProfileWithoutCreating( | 42 service_ = HistoryServiceFactory::GetForProfileWithoutCreating( |
41 browser()->profile()); | 43 browser()->profile()); |
42 SetHistoryDeletionPref(true); | 44 SetHistoryDeletionPref(true); |
43 SetDeletionPeriodPref(BrowsingDataRemover::EVERYTHING); | 45 SetDeletionPeriodPref(browsing_data::EVERYTHING); |
44 } | 46 } |
45 | 47 |
46 void AddVisit(const std::string url) { | 48 void AddVisit(const std::string url) { |
47 service_->AddPage(GURL(url), time_, history::SOURCE_BROWSED); | 49 service_->AddPage(GURL(url), time_, history::SOURCE_BROWSED); |
48 } | 50 } |
49 | 51 |
50 const base::Time& GetCurrentTime() { | 52 const base::Time& GetCurrentTime() { |
51 return time_; | 53 return time_; |
52 } | 54 } |
53 | 55 |
54 void RevertTimeInDays(int days) { | 56 void RevertTimeInDays(int days) { |
55 time_ -= base::TimeDelta::FromDays(days); | 57 time_ -= base::TimeDelta::FromDays(days); |
56 } | 58 } |
57 | 59 |
58 void SetHistoryDeletionPref(bool value) { | 60 void SetHistoryDeletionPref(bool value) { |
59 browser()->profile()->GetPrefs()->SetBoolean( | 61 browser()->profile()->GetPrefs()->SetBoolean( |
60 prefs::kDeleteBrowsingHistory, value); | 62 prefs::kDeleteBrowsingHistory, value); |
61 } | 63 } |
62 | 64 |
63 void SetDeletionPeriodPref(BrowsingDataRemover::TimePeriod period) { | 65 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { |
64 browser()->profile()->GetPrefs()->SetInteger( | 66 browser()->profile()->GetPrefs()->SetInteger( |
65 prefs::kDeleteTimePeriod, static_cast<int>(period)); | 67 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); |
66 } | 68 } |
67 | 69 |
68 void WaitForCounting() { | 70 void WaitForCounting() { |
69 run_loop_.reset(new base::RunLoop()); | 71 run_loop_.reset(new base::RunLoop()); |
70 run_loop_->Run(); | 72 run_loop_->Run(); |
71 } | 73 } |
72 | 74 |
73 BrowsingDataCounter::ResultInt GetLocalResult() { | 75 browsing_data::BrowsingDataCounter::ResultInt GetLocalResult() { |
74 DCHECK(finished_); | 76 DCHECK(finished_); |
75 return local_result_; | 77 return local_result_; |
76 } | 78 } |
77 | 79 |
78 bool HasSyncedVisits() { | 80 bool HasSyncedVisits() { |
79 DCHECK(finished_); | 81 DCHECK(finished_); |
80 return has_synced_visits_; | 82 return has_synced_visits_; |
81 } | 83 } |
82 | 84 |
83 void Callback(std::unique_ptr<BrowsingDataCounter::Result> result) { | 85 void Callback( |
| 86 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { |
84 finished_ = result->Finished(); | 87 finished_ = result->Finished(); |
85 | 88 |
86 if (finished_) { | 89 if (finished_) { |
87 HistoryCounter::HistoryResult* history_result = | 90 HistoryCounter::HistoryResult* history_result = |
88 static_cast<HistoryCounter::HistoryResult*>(result.get()); | 91 static_cast<HistoryCounter::HistoryResult*>(result.get()); |
89 | 92 |
90 local_result_ = history_result->Value(); | 93 local_result_ = history_result->Value(); |
91 has_synced_visits_ = history_result->has_synced_visits(); | 94 has_synced_visits_ = history_result->has_synced_visits(); |
92 } | 95 } |
93 | 96 |
(...skipping 14 matching lines...) Expand all Loading... |
108 WaitForCounting(); | 111 WaitForCounting(); |
109 CountingFinishedSinceLastAsked(); | 112 CountingFinishedSinceLastAsked(); |
110 } | 113 } |
111 | 114 |
112 private: | 115 private: |
113 std::unique_ptr<base::RunLoop> run_loop_; | 116 std::unique_ptr<base::RunLoop> run_loop_; |
114 history::HistoryService* service_; | 117 history::HistoryService* service_; |
115 base::Time time_; | 118 base::Time time_; |
116 | 119 |
117 bool finished_; | 120 bool finished_; |
118 BrowsingDataCounter::ResultInt local_result_; | 121 browsing_data::BrowsingDataCounter::ResultInt local_result_; |
119 bool has_synced_visits_; | 122 bool has_synced_visits_; |
120 }; | 123 }; |
121 | 124 |
122 // Tests that the counter considers duplicate visits from the same day | 125 // Tests that the counter considers duplicate visits from the same day |
123 // to be a single item. | 126 // to be a single item. |
124 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, DuplicateVisits) { | 127 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, DuplicateVisits) { |
125 AddVisit("https://www.google.com"); // 1 item | 128 AddVisit("https://www.google.com"); // 1 item |
126 AddVisit("https://www.google.com"); | 129 AddVisit("https://www.google.com"); |
127 AddVisit("https://www.chrome.com"); // 2 items | 130 AddVisit("https://www.chrome.com"); // 2 items |
128 AddVisit("https://www.chrome.com"); | 131 AddVisit("https://www.chrome.com"); |
129 AddVisit("https://www.chrome.com"); | 132 AddVisit("https://www.chrome.com"); |
130 AddVisit("https://www.example.com"); // 3 items | 133 AddVisit("https://www.example.com"); // 3 items |
131 | 134 |
132 RevertTimeInDays(1); | 135 RevertTimeInDays(1); |
133 AddVisit("https://www.google.com"); // 4 items | 136 AddVisit("https://www.google.com"); // 4 items |
134 AddVisit("https://www.example.com"); // 5 items | 137 AddVisit("https://www.example.com"); // 5 items |
135 AddVisit("https://www.example.com"); | 138 AddVisit("https://www.example.com"); |
136 | 139 |
137 RevertTimeInDays(1); | 140 RevertTimeInDays(1); |
138 AddVisit("https://www.chrome.com"); // 6 items | 141 AddVisit("https://www.chrome.com"); // 6 items |
139 AddVisit("https://www.chrome.com"); | 142 AddVisit("https://www.chrome.com"); |
140 AddVisit("https://www.google.com"); // 7 items | 143 AddVisit("https://www.google.com"); // 7 items |
141 AddVisit("https://www.chrome.com"); | 144 AddVisit("https://www.chrome.com"); |
142 AddVisit("https://www.google.com"); | 145 AddVisit("https://www.google.com"); |
143 AddVisit("https://www.google.com"); | 146 AddVisit("https://www.google.com"); |
144 AddVisit("https://www.chrome.com"); | 147 AddVisit("https://www.chrome.com"); |
145 | 148 |
146 HistoryCounter counter; | 149 Profile* profile = browser()->profile(); |
147 counter.Init(browser()->profile(), | 150 |
148 base::Bind(&HistoryCounterTest::Callback, | 151 HistoryCounter counter(profile); |
149 base::Unretained(this))); | 152 counter.Init(profile->GetPrefs(), base::Bind(&HistoryCounterTest::Callback, |
| 153 base::Unretained(this))); |
150 counter.Restart(); | 154 counter.Restart(); |
151 | 155 |
152 WaitForCounting(); | 156 WaitForCounting(); |
153 EXPECT_EQ(7u, GetLocalResult()); | 157 EXPECT_EQ(7u, GetLocalResult()); |
154 } | 158 } |
155 | 159 |
156 // Tests that the counter starts counting automatically when the deletion | 160 // Tests that the counter starts counting automatically when the deletion |
157 // pref changes to true. | 161 // pref changes to true. |
158 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PrefChanged) { | 162 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PrefChanged) { |
159 SetHistoryDeletionPref(false); | 163 SetHistoryDeletionPref(false); |
160 AddVisit("https://www.google.com"); | 164 AddVisit("https://www.google.com"); |
161 AddVisit("https://www.chrome.com"); | 165 AddVisit("https://www.chrome.com"); |
162 | 166 |
163 HistoryCounter counter; | 167 Profile* profile = browser()->profile(); |
164 counter.Init(browser()->profile(), | 168 |
165 base::Bind(&HistoryCounterTest::Callback, | 169 HistoryCounter counter(profile); |
166 base::Unretained(this))); | 170 counter.Init(profile->GetPrefs(), base::Bind(&HistoryCounterTest::Callback, |
| 171 base::Unretained(this))); |
167 SetHistoryDeletionPref(true); | 172 SetHistoryDeletionPref(true); |
168 | 173 |
169 WaitForCounting(); | 174 WaitForCounting(); |
170 EXPECT_EQ(2u, GetLocalResult()); | 175 EXPECT_EQ(2u, GetLocalResult()); |
171 } | 176 } |
172 | 177 |
173 // Tests that the counter does not count history if the deletion | 178 // Tests that the counter does not count history if the deletion |
174 // preference is false. | 179 // preference is false. |
175 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PrefIsFalse) { | 180 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PrefIsFalse) { |
176 SetHistoryDeletionPref(false); | 181 SetHistoryDeletionPref(false); |
177 AddVisit("https://www.google.com"); | 182 AddVisit("https://www.google.com"); |
178 | 183 |
179 HistoryCounter counter; | 184 Profile* profile = browser()->profile(); |
180 counter.Init(browser()->profile(), | 185 |
181 base::Bind(&HistoryCounterTest::Callback, | 186 HistoryCounter counter(profile); |
182 base::Unretained(this))); | 187 counter.Init(profile->GetPrefs(), base::Bind(&HistoryCounterTest::Callback, |
| 188 base::Unretained(this))); |
183 counter.Restart(); | 189 counter.Restart(); |
184 | 190 |
185 EXPECT_FALSE(counter.HasTrackedTasks()); | 191 EXPECT_FALSE(counter.HasTrackedTasks()); |
186 } | 192 } |
187 | 193 |
188 // Tests that changing the deletion period restarts the counting, and that | 194 // Tests that changing the deletion period restarts the counting, and that |
189 // the result takes visit dates into account. | 195 // the result takes visit dates into account. |
190 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PeriodChanged) { | 196 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PeriodChanged) { |
191 AddVisit("https://www.google.com"); | 197 AddVisit("https://www.google.com"); |
192 | 198 |
193 RevertTimeInDays(2); | 199 RevertTimeInDays(2); |
194 AddVisit("https://www.google.com"); | 200 AddVisit("https://www.google.com"); |
195 AddVisit("https://www.example.com"); | 201 AddVisit("https://www.example.com"); |
196 | 202 |
197 RevertTimeInDays(4); | 203 RevertTimeInDays(4); |
198 AddVisit("https://www.chrome.com"); | 204 AddVisit("https://www.chrome.com"); |
199 AddVisit("https://www.chrome.com"); | 205 AddVisit("https://www.chrome.com"); |
200 AddVisit("https://www.example.com"); | 206 AddVisit("https://www.example.com"); |
201 | 207 |
202 RevertTimeInDays(20); | 208 RevertTimeInDays(20); |
203 AddVisit("https://www.google.com"); | 209 AddVisit("https://www.google.com"); |
204 AddVisit("https://www.chrome.com"); | 210 AddVisit("https://www.chrome.com"); |
205 AddVisit("https://www.example.com"); | 211 AddVisit("https://www.example.com"); |
206 | 212 |
207 RevertTimeInDays(10); | 213 RevertTimeInDays(10); |
208 AddVisit("https://www.example.com"); | 214 AddVisit("https://www.example.com"); |
209 AddVisit("https://www.example.com"); | 215 AddVisit("https://www.example.com"); |
210 AddVisit("https://www.example.com"); | 216 AddVisit("https://www.example.com"); |
211 | 217 |
212 HistoryCounter counter; | 218 Profile* profile = browser()->profile(); |
213 counter.Init(browser()->profile(), | |
214 base::Bind(&HistoryCounterTest::Callback, | |
215 base::Unretained(this))); | |
216 | 219 |
217 SetDeletionPeriodPref(BrowsingDataRemover::LAST_HOUR); | 220 HistoryCounter counter(profile); |
| 221 counter.Init(profile->GetPrefs(), base::Bind(&HistoryCounterTest::Callback, |
| 222 base::Unretained(this))); |
| 223 |
| 224 SetDeletionPeriodPref(browsing_data::LAST_HOUR); |
218 WaitForCounting(); | 225 WaitForCounting(); |
219 EXPECT_EQ(1u, GetLocalResult()); | 226 EXPECT_EQ(1u, GetLocalResult()); |
220 | 227 |
221 SetDeletionPeriodPref(BrowsingDataRemover::LAST_DAY); | 228 SetDeletionPeriodPref(browsing_data::LAST_DAY); |
222 WaitForCounting(); | 229 WaitForCounting(); |
223 EXPECT_EQ(1u, GetLocalResult()); | 230 EXPECT_EQ(1u, GetLocalResult()); |
224 | 231 |
225 SetDeletionPeriodPref(BrowsingDataRemover::LAST_WEEK); | 232 SetDeletionPeriodPref(browsing_data::LAST_WEEK); |
226 WaitForCounting(); | 233 WaitForCounting(); |
227 EXPECT_EQ(5u, GetLocalResult()); | 234 EXPECT_EQ(5u, GetLocalResult()); |
228 | 235 |
229 SetDeletionPeriodPref(BrowsingDataRemover::FOUR_WEEKS); | 236 SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); |
230 WaitForCounting(); | 237 WaitForCounting(); |
231 EXPECT_EQ(8u, GetLocalResult()); | 238 EXPECT_EQ(8u, GetLocalResult()); |
232 | 239 |
233 SetDeletionPeriodPref(BrowsingDataRemover::EVERYTHING); | 240 SetDeletionPeriodPref(browsing_data::EVERYTHING); |
234 WaitForCounting(); | 241 WaitForCounting(); |
235 EXPECT_EQ(9u, GetLocalResult()); | 242 EXPECT_EQ(9u, GetLocalResult()); |
236 } | 243 } |
237 | 244 |
238 // Test the behavior for a profile that syncs history. | 245 // Test the behavior for a profile that syncs history. |
239 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, Synced) { | 246 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, Synced) { |
240 // WebHistoryService makes network requests, so we need to use a fake one | 247 // WebHistoryService makes network requests, so we need to use a fake one |
241 // for testing. | 248 // for testing. |
| 249 Profile* profile = browser()->profile(); |
| 250 |
242 std::unique_ptr<history::FakeWebHistoryService> service( | 251 std::unique_ptr<history::FakeWebHistoryService> service( |
243 new history::FakeWebHistoryService( | 252 new history::FakeWebHistoryService( |
244 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()), | 253 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
245 SigninManagerFactory::GetForProfile(browser()->profile()), | 254 SigninManagerFactory::GetForProfile(profile), |
246 browser()->profile()->GetRequestContext())); | 255 profile->GetRequestContext())); |
247 | 256 |
248 HistoryCounter counter; | 257 HistoryCounter counter(profile); |
249 counter.SetWebHistoryServiceForTesting(service.get()); | 258 counter.SetWebHistoryServiceForTesting(service.get()); |
250 counter.Init(browser()->profile(), | 259 counter.Init(profile->GetPrefs(), base::Bind(&HistoryCounterTest::Callback, |
251 base::Bind(&HistoryCounterTest::Callback, | 260 base::Unretained(this))); |
252 base::Unretained(this))); | |
253 | 261 |
254 // No entries locally and no entries in Sync. | 262 // No entries locally and no entries in Sync. |
255 service->SetupFakeResponse(true /* success */, net::HTTP_OK); | 263 service->SetupFakeResponse(true /* success */, net::HTTP_OK); |
256 counter.Restart(); | 264 counter.Restart(); |
257 WaitForCounting(); | 265 WaitForCounting(); |
258 EXPECT_EQ(0u, GetLocalResult()); | 266 EXPECT_EQ(0u, GetLocalResult()); |
259 EXPECT_FALSE(HasSyncedVisits()); | 267 EXPECT_FALSE(HasSyncedVisits()); |
260 | 268 |
261 // No entries locally. There are some entries in Sync, but they are out of the | 269 // No entries locally. There are some entries in Sync, but they are out of the |
262 // time range. | 270 // time range. |
263 SetDeletionPeriodPref(BrowsingDataRemover::LAST_HOUR); | 271 SetDeletionPeriodPref(browsing_data::LAST_HOUR); |
264 service->AddSyncedVisit( | 272 service->AddSyncedVisit( |
265 "www.google.com", GetCurrentTime() - base::TimeDelta::FromHours(2)); | 273 "www.google.com", GetCurrentTime() - base::TimeDelta::FromHours(2)); |
266 service->AddSyncedVisit( | 274 service->AddSyncedVisit( |
267 "www.chrome.com", GetCurrentTime() - base::TimeDelta::FromHours(2)); | 275 "www.chrome.com", GetCurrentTime() - base::TimeDelta::FromHours(2)); |
268 service->SetupFakeResponse(true /* success */, net::HTTP_OK); | 276 service->SetupFakeResponse(true /* success */, net::HTTP_OK); |
269 counter.Restart(); | 277 counter.Restart(); |
270 WaitForCounting(); | 278 WaitForCounting(); |
271 EXPECT_EQ(0u, GetLocalResult()); | 279 EXPECT_EQ(0u, GetLocalResult()); |
272 EXPECT_FALSE(HasSyncedVisits()); | 280 EXPECT_FALSE(HasSyncedVisits()); |
273 | 281 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 static const int kFirstProfileIndex = 0; | 331 static const int kFirstProfileIndex = 0; |
324 ProfileSyncService* sync_service = GetSyncService(kFirstProfileIndex); | 332 ProfileSyncService* sync_service = GetSyncService(kFirstProfileIndex); |
325 Profile* profile = GetProfile(kFirstProfileIndex); | 333 Profile* profile = GetProfile(kFirstProfileIndex); |
326 | 334 |
327 // Set up the fake web history service and the counter. | 335 // Set up the fake web history service and the counter. |
328 std::unique_ptr<history::FakeWebHistoryService> web_history_service( | 336 std::unique_ptr<history::FakeWebHistoryService> web_history_service( |
329 new history::FakeWebHistoryService( | 337 new history::FakeWebHistoryService( |
330 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()), | 338 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()), |
331 SigninManagerFactory::GetForProfile(browser()->profile()), | 339 SigninManagerFactory::GetForProfile(browser()->profile()), |
332 browser()->profile()->GetRequestContext())); | 340 browser()->profile()->GetRequestContext())); |
333 HistoryCounter counter; | 341 HistoryCounter counter(profile); |
334 counter.SetWebHistoryServiceForTesting(web_history_service.get()); | 342 counter.SetWebHistoryServiceForTesting(web_history_service.get()); |
335 counter.Init(profile, | 343 counter.Init(profile->GetPrefs(), base::Bind(&HistoryCounterTest::Callback, |
336 base::Bind(&HistoryCounterTest::Callback, | 344 base::Unretained(this))); |
337 base::Unretained(this))); | |
338 | 345 |
339 // Note that some Sync operations notify observers immediately (and thus there | 346 // Note that some Sync operations notify observers immediately (and thus there |
340 // is no need to call |WaitForCounting()|; in fact, it would block the test), | 347 // is no need to call |WaitForCounting()|; in fact, it would block the test), |
341 // while other operations only post the task on UI thread's message loop | 348 // while other operations only post the task on UI thread's message loop |
342 // (which requires calling |WaitForCounting()| for them to run). Therefore, | 349 // (which requires calling |WaitForCounting()| for them to run). Therefore, |
343 // this test always checks if the callback has already run and only waits | 350 // this test always checks if the callback has already run and only waits |
344 // if it has not. | 351 // if it has not. |
345 | 352 |
346 // We sync all datatypes by default, so starting Sync means that we start | 353 // We sync all datatypes by default, so starting Sync means that we start |
347 // syncing history deletion, and this should restart the counter. | 354 // syncing history deletion, and this should restart the counter. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // history deletion did not change. However, in reality we can get two | 395 // history deletion did not change. However, in reality we can get two |
389 // notifications, one that history sync has stopped and another that it is | 396 // notifications, one that history sync has stopped and another that it is |
390 // active again. | 397 // active again. |
391 | 398 |
392 // Stopping the Sync service triggers a restart. | 399 // Stopping the Sync service triggers a restart. |
393 sync_service->RequestStop(sync_driver::SyncService::CLEAR_DATA); | 400 sync_service->RequestStop(sync_driver::SyncService::CLEAR_DATA); |
394 WaitForCountingOrConfirmFinished(); | 401 WaitForCountingOrConfirmFinished(); |
395 } | 402 } |
396 | 403 |
397 } // namespace | 404 } // namespace |
OLD | NEW |