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" | |
15 #include "components/browser_sync/browser/profile_sync_service.h" | 14 #include "components/browser_sync/browser/profile_sync_service.h" |
16 #include "components/browsing_data/browsing_data_utils.h" | 15 #include "components/browsing_data/browsing_data_utils.h" |
17 #include "components/browsing_data/pref_names.h" | 16 #include "components/browsing_data/pref_names.h" |
18 #include "components/history/core/browser/history_service.h" | 17 #include "components/history/core/browser/history_service.h" |
19 #include "components/history/core/browser/web_history_service.h" | 18 #include "components/history/core/browser/web_history_service.h" |
20 #include "components/history/core/test/fake_web_history_service.h" | 19 #include "components/history/core/test/fake_web_history_service.h" |
21 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
22 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 21 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
23 #include "components/signin/core/browser/signin_manager.h" | 22 #include "components/signin/core/browser/signin_manager.h" |
24 #include "net/http/http_status_code.h" | 23 #include "net/http/http_status_code.h" |
(...skipping 27 matching lines...) Expand all Loading... |
52 const base::Time& GetCurrentTime() { | 51 const base::Time& GetCurrentTime() { |
53 return time_; | 52 return time_; |
54 } | 53 } |
55 | 54 |
56 void RevertTimeInDays(int days) { | 55 void RevertTimeInDays(int days) { |
57 time_ -= base::TimeDelta::FromDays(days); | 56 time_ -= base::TimeDelta::FromDays(days); |
58 } | 57 } |
59 | 58 |
60 void SetHistoryDeletionPref(bool value) { | 59 void SetHistoryDeletionPref(bool value) { |
61 browser()->profile()->GetPrefs()->SetBoolean( | 60 browser()->profile()->GetPrefs()->SetBoolean( |
62 prefs::kDeleteBrowsingHistory, value); | 61 browsing_data::prefs::kDeleteBrowsingHistory, value); |
63 } | 62 } |
64 | 63 |
65 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { | 64 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { |
66 browser()->profile()->GetPrefs()->SetInteger( | 65 browser()->profile()->GetPrefs()->SetInteger( |
67 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); | 66 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); |
68 } | 67 } |
69 | 68 |
70 void WaitForCounting() { | 69 void WaitForCounting() { |
71 run_loop_.reset(new base::RunLoop()); | 70 run_loop_.reset(new base::RunLoop()); |
72 run_loop_->Run(); | 71 run_loop_->Run(); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // history deletion did not change. However, in reality we can get two | 394 // history deletion did not change. However, in reality we can get two |
396 // notifications, one that history sync has stopped and another that it is | 395 // notifications, one that history sync has stopped and another that it is |
397 // active again. | 396 // active again. |
398 | 397 |
399 // Stopping the Sync service triggers a restart. | 398 // Stopping the Sync service triggers a restart. |
400 sync_service->RequestStop(sync_driver::SyncService::CLEAR_DATA); | 399 sync_service->RequestStop(sync_driver::SyncService::CLEAR_DATA); |
401 WaitForCountingOrConfirmFinished(); | 400 WaitForCountingOrConfirmFinished(); |
402 } | 401 } |
403 | 402 |
404 } // namespace | 403 } // namespace |
OLD | NEW |