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

Unified Diff: chrome/browser/browsing_data/browsing_data_counter_utils_unittest.cc

Issue 2228913003: Move part of browsing data counter text util method to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/browsing_data_counter_utils_unittest.cc
diff --git a/chrome/browser/browsing_data/browsing_data_counter_utils_unittest.cc b/chrome/browser/browsing_data/browsing_data_counter_utils_unittest.cc
index c00812865fe05159ddc9e5a7e3e4f90ebbc67cca..db5bb3e905815a5b5d68021d74a36cadbcc7605a 100644
--- a/chrome/browser/browsing_data/browsing_data_counter_utils_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_counter_utils_unittest.cc
@@ -10,10 +10,8 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/web_data_service_factory.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
-#include "components/browsing_data/core/counters/autofill_counter.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(ENABLE_EXTENSIONS)
@@ -33,55 +31,6 @@ class BrowsingDataCounterUtilsTest : public testing::Test {
TestingProfile profile_;
};
-// Tests the complex output of the Autofill counter.
-TEST_F(BrowsingDataCounterUtilsTest, AutofillCounterResult) {
- browsing_data::AutofillCounter counter(
- WebDataServiceFactory::GetAutofillWebDataForProfile(
- GetProfile(), ServiceAccessType::EXPLICIT_ACCESS)
- .get());
-
- // This test assumes that the strings are served exactly as defined,
- // i.e. that the locale is set to the default "en".
- ASSERT_EQ("en", TestingBrowserProcess::GetGlobal()->GetApplicationLocale());
-
- // Test all configurations of zero and nonzero partial results for datatypes.
- // Test singular and plural for each datatype.
- const struct TestCase {
- int num_credit_cards;
- int num_addresses;
- int num_suggestions;
- std::string expected_output;
- } kTestCases[] = {
- {0, 0, 0, "none"},
- {1, 0, 0, "1 credit card"},
- {0, 5, 0, "5 addresses"},
- {0, 0, 1, "1 suggestion"},
- {0, 0, 2, "2 suggestions"},
- {4, 7, 0, "4 credit cards, 7 addresses"},
- {3, 0, 9, "3 credit cards, 9 other suggestions"},
- {0, 1, 1, "1 address, 1 other suggestion"},
- {9, 6, 3, "9 credit cards, 6 addresses, 3 others"},
- {4, 2, 1, "4 credit cards, 2 addresses, 1 other"},
- };
-
- for (const TestCase& test_case : kTestCases) {
- browsing_data::AutofillCounter::AutofillResult result(
- &counter, test_case.num_suggestions, test_case.num_credit_cards,
- test_case.num_addresses);
-
- SCOPED_TRACE(base::StringPrintf(
- "Test params: %d credit card(s), "
- "%d address(es), %d suggestion(s).",
- test_case.num_credit_cards,
- test_case.num_addresses,
- test_case.num_suggestions
- ));
-
- base::string16 output = GetCounterTextFromResult(&result);
- EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output));
- }
-}
-
#if defined(ENABLE_EXTENSIONS)
// Tests the complex output of the hosted apps counter.
TEST_F(BrowsingDataCounterUtilsTest, HostedAppsCounterResult) {
@@ -120,7 +69,7 @@ TEST_F(BrowsingDataCounterUtilsTest, HostedAppsCounterResult) {
apps.size(),
examples);
- base::string16 output = GetCounterTextFromResult(&result);
+ base::string16 output = GetChromeCounterTextFromResult(&result);
EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output));
}
}

Powered by Google App Engine
This is Rietveld 408576698