Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/browsing_data/autofill_counter_browsertest.cc

Issue 2623033003: Always show counters in the material design Clear Browsing Data dialog. (Closed)
Patch Set: iOS fix #2 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/browsing_data/cache_counter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; 194 scoped_refptr<autofill::AutofillWebDataService> web_data_service_;
195 195
196 bool finished_; 196 bool finished_;
197 browsing_data::BrowsingDataCounter::ResultInt num_suggestions_; 197 browsing_data::BrowsingDataCounter::ResultInt num_suggestions_;
198 browsing_data::BrowsingDataCounter::ResultInt num_credit_cards_; 198 browsing_data::BrowsingDataCounter::ResultInt num_credit_cards_;
199 browsing_data::BrowsingDataCounter::ResultInt num_addresses_; 199 browsing_data::BrowsingDataCounter::ResultInt num_addresses_;
200 200
201 DISALLOW_COPY_AND_ASSIGN(AutofillCounterTest); 201 DISALLOW_COPY_AND_ASSIGN(AutofillCounterTest);
202 }; 202 };
203 203
204 // Tests that the counter does not count when the form data deletion preference
205 // is false.
206 IN_PROC_BROWSER_TEST_F(AutofillCounterTest, PrefIsFalse) {
207 SetAutofillDeletionPref(false);
208
209 Profile* profile = browser()->profile();
210 browsing_data::AutofillCounter counter(GetWebDataService());
211 counter.Init(profile->GetPrefs(), base::Bind(&AutofillCounterTest::Callback,
212 base::Unretained(this)));
213 counter.Restart();
214
215 EXPECT_FALSE(counter.HasPendingQuery());
216 }
217
218 // Tests that we count the correct number of autocomplete suggestions. 204 // Tests that we count the correct number of autocomplete suggestions.
219 IN_PROC_BROWSER_TEST_F(AutofillCounterTest, AutocompleteSuggestions) { 205 IN_PROC_BROWSER_TEST_F(AutofillCounterTest, AutocompleteSuggestions) {
220 Profile* profile = browser()->profile(); 206 Profile* profile = browser()->profile();
221 browsing_data::AutofillCounter counter(GetWebDataService()); 207 browsing_data::AutofillCounter counter(GetWebDataService());
222 counter.Init(profile->GetPrefs(), base::Bind(&AutofillCounterTest::Callback, 208 counter.Init(profile->GetPrefs(), base::Bind(&AutofillCounterTest::Callback,
223 base::Unretained(this))); 209 base::Unretained(this)));
224 counter.Restart(); 210 counter.Restart();
225 WaitForCounting(); 211 WaitForCounting();
226 EXPECT_EQ(0, GetNumSuggestions()); 212 EXPECT_EQ(0, GetNumSuggestions());
227 213
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 counter.SetPeriodStartForTesting(test_case.period_start); 389 counter.SetPeriodStartForTesting(test_case.period_start);
404 counter.Restart(); 390 counter.Restart();
405 WaitForCounting(); 391 WaitForCounting();
406 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); 392 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions());
407 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); 393 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards());
408 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); 394 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses());
409 } 395 }
410 } 396 }
411 397
412 } // namespace 398 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/cache_counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698