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

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: Default flag value. Created 5 years 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 { 13 namespace browsing_data {
14 14
15 // Tests the complex output of the Autofill counter. 15 // Tests the complex output of the Autofill counter.
16 TEST(ClearBrowserDataTest, AutofillCounterResult) { 16 TEST(BrowsingDataHelpersTest, AutofillCounterResult) {
Bernhard Bauer 2015/12/16 13:35:32 Should this be called BrowsingDataCounterUtilsTest
msramek 2016/01/05 16:22:50 Yes! I originally had the file named helpers :)
17 AutofillCounter counter; 17 AutofillCounter counter;
18 18
19 // This test assumes that the strings are served exactly as defined, 19 // This test assumes that the strings are served exactly as defined,
20 // i.e. that the locale is set to the default "en". 20 // i.e. that the locale is set to the default "en".
21 ASSERT_EQ("en", TestingBrowserProcess::GetGlobal()->GetApplicationLocale()); 21 ASSERT_EQ("en", TestingBrowserProcess::GetGlobal()->GetApplicationLocale());
22 22
23 // Test all configurations of zero and nonzero partial results for datatypes. 23 // Test all configurations of zero and nonzero partial results for datatypes.
24 // Test singular and plural for each datatype. 24 // Test singular and plural for each datatype.
25 struct TestCase { 25 struct TestCase {
26 int num_credit_cards; 26 int num_credit_cards;
(...skipping 21 matching lines...) Expand all
48 test_case.num_addresses); 48 test_case.num_addresses);
49 49
50 SCOPED_TRACE(base::StringPrintf( 50 SCOPED_TRACE(base::StringPrintf(
51 "Test params: %d credit card(s), " 51 "Test params: %d credit card(s), "
52 "%d address(es), %d suggestion(s).", 52 "%d address(es), %d suggestion(s).",
53 test_case.num_credit_cards, 53 test_case.num_credit_cards,
54 test_case.num_addresses, 54 test_case.num_addresses,
55 test_case.num_suggestions 55 test_case.num_suggestions
56 )); 56 ));
57 57
58 base::string16 output = ClearBrowserDataHandler::GetCounterTextFromResult( 58 base::string16 output = GetCounterTextFromResult(&result);
59 &result);
60 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output)); 59 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output));
61 } 60 }
62 } 61 }
63 62
64 } // namespace options 63 } // namespace browsing_data
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698