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/autofill_counter.h" | 5 #include "chrome/browser/browsing_data/autofill_counter.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/web_data_service_factory.h" | 16 #include "chrome/browser/web_data_service_factory.h" |
17 #include "chrome/common/pref_names.h" | |
18 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "components/autofill/core/browser/autofill_profile.h" | 18 #include "components/autofill/core/browser/autofill_profile.h" |
20 #include "components/autofill/core/browser/autofill_type.h" | 19 #include "components/autofill/core/browser/autofill_type.h" |
21 #include "components/autofill/core/browser/credit_card.h" | 20 #include "components/autofill/core/browser/credit_card.h" |
22 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
23 #include "components/browsing_data/browsing_data_utils.h" | 22 #include "components/browsing_data/browsing_data_utils.h" |
24 #include "components/browsing_data/pref_names.h" | 23 #include "components/browsing_data/pref_names.h" |
25 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
26 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
27 | 26 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 content::BrowserThread::DB, FROM_HERE, | 126 content::BrowserThread::DB, FROM_HERE, |
128 base::Bind(&AutofillCounterTest::CallbackFromDBThread, | 127 base::Bind(&AutofillCounterTest::CallbackFromDBThread, |
129 base::Unretained(this))); | 128 base::Unretained(this))); |
130 | 129 |
131 run_loop_->Run(); | 130 run_loop_->Run(); |
132 } | 131 } |
133 | 132 |
134 // Other utils --------------------------------------------------------------- | 133 // Other utils --------------------------------------------------------------- |
135 | 134 |
136 void SetAutofillDeletionPref(bool value) { | 135 void SetAutofillDeletionPref(bool value) { |
137 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDeleteFormData, value); | 136 browser()->profile()->GetPrefs()->SetBoolean( |
| 137 browsing_data::prefs::kDeleteFormData, value); |
138 } | 138 } |
139 | 139 |
140 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { | 140 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { |
141 browser()->profile()->GetPrefs()->SetInteger( | 141 browser()->profile()->GetPrefs()->SetInteger( |
142 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); | 142 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); |
143 } | 143 } |
144 | 144 |
145 // Callback and result retrieval --------------------------------------------- | 145 // Callback and result retrieval --------------------------------------------- |
146 | 146 |
147 void WaitForCounting() { | 147 void WaitForCounting() { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 counter.SetPeriodStartForTesting(test_case.period_start); | 399 counter.SetPeriodStartForTesting(test_case.period_start); |
400 counter.Restart(); | 400 counter.Restart(); |
401 WaitForCounting(); | 401 WaitForCounting(); |
402 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); | 402 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); |
403 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); | 403 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); |
404 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); | 404 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); |
405 } | 405 } |
406 } | 406 } |
407 | 407 |
408 } // namespace | 408 } // namespace |
OLD | NEW |