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/passwords_counter.h" | 5 #include "chrome/browser/browsing_data/passwords_counter.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/password_manager/password_store_factory.h" | 9 #include "chrome/browser/password_manager/password_store_factory.h" |
10 #include "chrome/browser/sync/test/integration/passwords_helper.h" | 10 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/common/pref_names.h" | |
13 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
15 #include "components/browsing_data/browsing_data_utils.h" | 14 #include "components/browsing_data/browsing_data_utils.h" |
16 #include "components/browsing_data/pref_names.h" | 15 #include "components/browsing_data/pref_names.h" |
17 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 using autofill::PasswordForm; | 20 using autofill::PasswordForm; |
22 | 21 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 run_loop_->RunUntilIdle(); | 57 run_loop_->RunUntilIdle(); |
59 } | 58 } |
60 | 59 |
61 void OnLoginsChanged( | 60 void OnLoginsChanged( |
62 const password_manager::PasswordStoreChangeList& changes) override { | 61 const password_manager::PasswordStoreChangeList& changes) override { |
63 run_loop_->Quit(); | 62 run_loop_->Quit(); |
64 } | 63 } |
65 | 64 |
66 void SetPasswordsDeletionPref(bool value) { | 65 void SetPasswordsDeletionPref(bool value) { |
67 browser()->profile()->GetPrefs()->SetBoolean( | 66 browser()->profile()->GetPrefs()->SetBoolean( |
68 prefs::kDeletePasswords, value); | 67 browsing_data::prefs::kDeletePasswords, value); |
69 } | 68 } |
70 | 69 |
71 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { | 70 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { |
72 browser()->profile()->GetPrefs()->SetInteger( | 71 browser()->profile()->GetPrefs()->SetInteger( |
73 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); | 72 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); |
74 } | 73 } |
75 | 74 |
76 void RevertTimeInDays(int days) { | 75 void RevertTimeInDays(int days) { |
77 time_ -= base::TimeDelta::FromDays(days); | 76 time_ -= base::TimeDelta::FromDays(days); |
78 } | 77 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); | 247 SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); |
249 WaitForCounting(); | 248 WaitForCounting(); |
250 EXPECT_EQ(3u, GetResult()); | 249 EXPECT_EQ(3u, GetResult()); |
251 | 250 |
252 SetDeletionPeriodPref(browsing_data::EVERYTHING); | 251 SetDeletionPeriodPref(browsing_data::EVERYTHING); |
253 WaitForCounting(); | 252 WaitForCounting(); |
254 EXPECT_EQ(4u, GetResult()); | 253 EXPECT_EQ(4u, GetResult()); |
255 } | 254 } |
256 | 255 |
257 } // namespace | 256 } // namespace |
OLD | NEW |