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

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

Issue 1527653004: Move browsing data counters helper functions to an 'utils' file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, solved conflict in #includes Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/webui/options/clear_browser_data_handler.h" 5 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browsing_data/autofill_counter.h" 9 #include "chrome/browser/browsing_data/autofill_counter.h"
10 #include "chrome/test/base/testing_browser_process.h" 10 #include "chrome/test/base/testing_browser_process.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace options {
14
15 // Tests the complex output of the Autofill counter. 13 // Tests the complex output of the Autofill counter.
16 TEST(ClearBrowserDataTest, AutofillCounterResult) { 14 TEST(BrowsingDataCounterUtilsTest, AutofillCounterResult) {
17 AutofillCounter counter; 15 AutofillCounter counter;
18 16
19 // This test assumes that the strings are served exactly as defined, 17 // This test assumes that the strings are served exactly as defined,
20 // i.e. that the locale is set to the default "en". 18 // i.e. that the locale is set to the default "en".
21 ASSERT_EQ("en", TestingBrowserProcess::GetGlobal()->GetApplicationLocale()); 19 ASSERT_EQ("en", TestingBrowserProcess::GetGlobal()->GetApplicationLocale());
22 20
23 // Test all configurations of zero and nonzero partial results for datatypes. 21 // Test all configurations of zero and nonzero partial results for datatypes.
24 // Test singular and plural for each datatype. 22 // Test singular and plural for each datatype.
25 struct TestCase { 23 struct TestCase {
26 int num_credit_cards; 24 int num_credit_cards;
(...skipping 21 matching lines...) Expand all
48 test_case.num_addresses); 46 test_case.num_addresses);
49 47
50 SCOPED_TRACE(base::StringPrintf( 48 SCOPED_TRACE(base::StringPrintf(
51 "Test params: %d credit card(s), " 49 "Test params: %d credit card(s), "
52 "%d address(es), %d suggestion(s).", 50 "%d address(es), %d suggestion(s).",
53 test_case.num_credit_cards, 51 test_case.num_credit_cards,
54 test_case.num_addresses, 52 test_case.num_addresses,
55 test_case.num_suggestions 53 test_case.num_suggestions
56 )); 54 ));
57 55
58 base::string16 output = ClearBrowserDataHandler::GetCounterTextFromResult( 56 base::string16 output = GetCounterTextFromResult(&result);
59 &result);
60 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output)); 57 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output));
61 } 58 }
62 } 59 }
63
64 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698