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

Unified Diff: components/browsing_data/core/browsing_data_utils_unittest.cc

Issue 2798243004: Show password sync status in CBD (Closed)
Patch Set: fix browser_tests and ios Created 3 years, 8 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: components/browsing_data/core/browsing_data_utils_unittest.cc
diff --git a/components/browsing_data/core/browsing_data_utils_unittest.cc b/components/browsing_data/core/browsing_data_utils_unittest.cc
index bd22d2867be2276ee856f1ffa33d82fdaf1efb69..ceebd10f553f7613277f7c38544bcd43510d9daf 100644
--- a/components/browsing_data/core/browsing_data_utils_unittest.cc
+++ b/components/browsing_data/core/browsing_data_utils_unittest.cc
@@ -12,6 +12,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/browsing_data/core/counters/autofill_counter.h"
+#include "components/browsing_data/core/counters/passwords_counter.h"
#include "components/browsing_data/core/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
@@ -88,6 +89,32 @@ TEST_F(BrowsingDataUtilsTest, AutofillCounterResult) {
}
}
+// Tests the output of the Passwords counter.
+TEST_F(BrowsingDataUtilsTest, PasswordsCounterResult) {
+ browsing_data::PasswordsCounter counter(
+ scoped_refptr<password_manager::PasswordStore>(nullptr), nullptr);
+
+ const struct TestCase {
+ int num_passwords;
+ int is_synced;
+ std::string expected_output;
+ } kTestCases[] = {
+ {0, false, "none"}, {0, true, "none"},
+ {1, false, "1 password"}, {1, true, "1 password (synced)"},
+ {5, false, "5 passwords"}, {5, true, "5 passwords (synced)"},
+ };
+
+ for (const TestCase& test_case : kTestCases) {
+ browsing_data::PasswordsCounter::PasswordResult result(
+ &counter, test_case.num_passwords, test_case.is_synced);
+ SCOPED_TRACE(base::StringPrintf("Test params: %d password(s), %d is_synced",
+ test_case.num_passwords,
+ test_case.is_synced));
+ base::string16 output = browsing_data::GetCounterTextFromResult(&result);
+ EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output));
+ }
+}
+
TEST_F(BrowsingDataUtilsTest, MigratePreferencesToBasic) {
using namespace browsing_data::prefs;

Powered by Google App Engine
This is Rietveld 408576698