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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc

Issue 1151373006: Update Confirmation UI for saved password change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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/ui/passwords/manage_passwords_view_utils_unittest.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc
index c02b0ae9229a084556f82351c2da814403cce383..15c121f992fd8e0698cb169550978c149e52b851 100644
--- a/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc
@@ -16,41 +16,50 @@ TEST(ManagePasswordsViewUtilTest, GetSavePasswordDialogTitleTextAndLinkRange) {
const char* const user_visible_url;
const char* const form_origin_url;
bool is_smartlock_branding_enabled;
+ bool is_update_password_bubble;
const char* const expected_title_text_ends_with;
size_t expected_link_range_start;
size_t expected_link_range_end;
} test_cases[] = {
// Same domains.
{"http://example.com/landing", "http://example.com/login#form?value=3",
- false, "this site?", 0, 0},
+ false, false, "this site?", 0, 0},
{"http://example.com/landing", "http://example.com/login#form?value=3",
- true, "this site?", 12, 29},
+ true, false, "this site?", 12, 29},
// Different subdomains.
{"https://a.example.com/landing",
- "https://b.example.com/login#form?value=3", false, "this site?", 0, 0},
+ "https://b.example.com/login#form?value=3", false, false, "this site?",
+ 0, 0},
{"https://a.example.com/landing",
- "https://b.example.com/login#form?value=3", true, "this site?", 12, 29},
+ "https://b.example.com/login#form?value=3", true, false, "this site?",
+ 12, 29},
// Different domains.
{"https://another.org", "https://example.com:/login#form?value=3", false,
- "https://example.com?", 0, 0},
+ false, "https://example.com?", 0, 0},
{"https://another.org", "https://example.com/login#form?value=3", true,
- "https://example.com?", 12, 29},
+ false, "https://example.com?", 12, 29},
// Different domains and password form origin url with
// default port for the scheme.
{"https://another.org", "https://example.com:443/login#form?value=3",
- false, "https://example.com?", 0, 0},
+ false, false, "https://example.com?", 0, 0},
{"https://another.org", "http://example.com:80/login#form?value=3", true,
- "http://example.com?", 12, 29},
+ false, "http://example.com?", 12, 29},
// Different domains and password form origin url with
// non-default port for the scheme.
{"https://another.org", "https://example.com:8001/login#form?value=3",
- false, "https://example.com:8001?", 0, 0},
+ false, false, "https://example.com:8001?", 0, 0},
{"https://another.org", "https://example.com:8001/login#form?value=3",
- true, "https://example.com:8001?", 12, 29}};
+ true, false, "https://example.com:8001?", 12, 29},
+
+ // Update bubble.
+ {"http://example.com/landing", "http://example.com/login#form?value=3",
+ false, true, "this site?", 0, 0},
+ {"http://example.com/landing", "http://example.com/login#form?value=3",
+ true, true, "this site?", 12, 29}};
for (size_t i = 0; i < arraysize(test_cases); ++i) {
SCOPED_TRACE(testing::Message()
@@ -62,7 +71,8 @@ TEST(ManagePasswordsViewUtilTest, GetSavePasswordDialogTitleTextAndLinkRange) {
GetSavePasswordDialogTitleTextAndLinkRange(
GURL(test_cases[i].user_visible_url),
GURL(test_cases[i].form_origin_url),
- test_cases[i].is_smartlock_branding_enabled, &title, &title_link_range);
+ test_cases[i].is_smartlock_branding_enabled,
+ test_cases[i].is_update_password_bubble, &title, &title_link_range);
// Verify against expectations.
EXPECT_TRUE(base::EndsWith(
@@ -71,5 +81,12 @@ TEST(ManagePasswordsViewUtilTest, GetSavePasswordDialogTitleTextAndLinkRange) {
EXPECT_EQ(test_cases[i].expected_link_range_start,
title_link_range.start());
EXPECT_EQ(test_cases[i].expected_link_range_end, title_link_range.end());
+ if (test_cases[i].is_update_password_bubble) {
+ EXPECT_TRUE(title.find(base::ASCIIToUTF16("update")) !=
+ base::string16::npos);
+ } else {
+ EXPECT_TRUE(title.find(base::ASCIIToUTF16("save")) !=
+ base::string16::npos);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698