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

Unified Diff: components/password_manager/core/browser/login_database_unittest.cc

Issue 1087233002: Report the number of empty usernames without a nonempty pair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/password_manager/core/browser/login_database_unittest.cc
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc
index c45cc5f40aed23079159ebddbf9f3d7ec990ad61..a82b2c765a9c20d8f273db6e095c339ea2fee6a6 100644
--- a/components/password_manager/core/browser/login_database_unittest.cc
+++ b/components/password_manager/core/browser/login_database_unittest.cc
@@ -1055,12 +1055,22 @@ TEST_F(LoginDatabaseTest, ReportMetricsTest) {
password_form.blacklisted_by_user = true;
EXPECT_EQ(AddChangeForForm(password_form), db().AddLogin(password_form));
+ password_form.origin = GURL("http://sixth.example.com/");
+ password_form.signon_realm = "http://sixth.example.com/";
+ password_form.username_value = ASCIIToUTF16("");
+ password_form.password_value = ASCIIToUTF16("my_password");
+ password_form.blacklisted_by_user = false;
+ EXPECT_EQ(AddChangeForForm(password_form), db().AddLogin(password_form));
engedy 2015/04/15 15:29:26 Just to be on the safe side, could you please add
msramek 2015/04/16 14:34:26 Since CountInDatabase counts +1 for every entry, w
engedy 2015/04/16 14:44:32 Yeah, I wanted to add this comment to "fourth", bu
+
+ password_form.username_value = ASCIIToUTF16("my_username");
+ EXPECT_EQ(AddChangeForForm(password_form), db().AddLogin(password_form));
+
base::HistogramTester histogram_tester;
db().ReportMetrics("", false);
histogram_tester.ExpectUniqueSample(
"PasswordManager.TotalAccounts.UserCreated.WithoutCustomPassphrase",
- 4,
+ 6,
1);
histogram_tester.ExpectBucketCount(
"PasswordManager.AccountsPerSite.UserCreated.WithoutCustomPassphrase",
@@ -1069,7 +1079,7 @@ TEST_F(LoginDatabaseTest, ReportMetricsTest) {
histogram_tester.ExpectBucketCount(
"PasswordManager.AccountsPerSite.UserCreated.WithoutCustomPassphrase",
2,
- 1);
+ 2);
histogram_tester.ExpectBucketCount(
"PasswordManager.TimesPasswordUsed.UserCreated.WithoutCustomPassphrase",
0,
@@ -1100,6 +1110,10 @@ TEST_F(LoginDatabaseTest, ReportMetricsTest) {
1);
histogram_tester.ExpectUniqueSample(
"PasswordManager.EmptyUsernames.CountInDatabase",
+ 2,
+ 1);
+ histogram_tester.ExpectUniqueSample(
+ "PasswordManager.EmptyUsernames.NotPairedWithNonempty",
1,
1);
}

Powered by Google App Engine
This is Rietveld 408576698