| 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 "components/browsing_data/core/counters/autofill_counter.h" | 5 #include "components/browsing_data/core/counters/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" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Other autofill utils ------------------------------------------------------ | 107 // Other autofill utils ------------------------------------------------------ |
| 108 | 108 |
| 109 void ClearCreditCardsAndAddresses() { | 109 void ClearCreditCardsAndAddresses() { |
| 110 web_data_service_->RemoveAutofillDataModifiedBetween( | 110 web_data_service_->RemoveAutofillDataModifiedBetween( |
| 111 base::Time(), base::Time::Max()); | 111 base::Time(), base::Time::Max()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void CallbackFromDBThread() { | 114 void CallbackFromDBThread() { |
| 115 content::BrowserThread::PostTask( | 115 content::BrowserThread::PostTask( |
| 116 content::BrowserThread::UI, FROM_HERE, | 116 content::BrowserThread::UI, FROM_HERE, |
| 117 base::Bind(&base::RunLoop::Quit, | 117 base::BindOnce(&base::RunLoop::Quit, |
| 118 base::Unretained(run_loop_.get()))); | 118 base::Unretained(run_loop_.get()))); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void WaitForDBThread() { | 121 void WaitForDBThread() { |
| 122 run_loop_.reset(new base::RunLoop()); | 122 run_loop_.reset(new base::RunLoop()); |
| 123 | 123 |
| 124 content::BrowserThread::PostTask( | 124 content::BrowserThread::PostTask( |
| 125 content::BrowserThread::DB, FROM_HERE, | 125 content::BrowserThread::DB, FROM_HERE, |
| 126 base::Bind(&AutofillCounterTest::CallbackFromDBThread, | 126 base::BindOnce(&AutofillCounterTest::CallbackFromDBThread, |
| 127 base::Unretained(this))); | 127 base::Unretained(this))); |
| 128 | 128 |
| 129 run_loop_->Run(); | 129 run_loop_->Run(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Other utils --------------------------------------------------------------- | 132 // Other utils --------------------------------------------------------------- |
| 133 | 133 |
| 134 void SetAutofillDeletionPref(bool value) { | 134 void SetAutofillDeletionPref(bool value) { |
| 135 browser()->profile()->GetPrefs()->SetBoolean( | 135 browser()->profile()->GetPrefs()->SetBoolean( |
| 136 browsing_data::prefs::kDeleteFormData, value); | 136 browsing_data::prefs::kDeleteFormData, value); |
| 137 } | 137 } |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 counter.SetPeriodStartForTesting(test_case.period_start); | 394 counter.SetPeriodStartForTesting(test_case.period_start); |
| 395 counter.Restart(); | 395 counter.Restart(); |
| 396 WaitForCounting(); | 396 WaitForCounting(); |
| 397 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); | 397 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); |
| 398 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); | 398 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); |
| 399 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); | 399 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace | 403 } // namespace |
| OLD | NEW |