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

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

Issue 1318523011: [Password Manager] Copiable username and origin. Linkable origin elided from the left. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Icons appearance fixed Created 5 years, 2 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/affiliation_utils_unittest.cc
diff --git a/components/password_manager/core/browser/affiliation_utils_unittest.cc b/components/password_manager/core/browser/affiliation_utils_unittest.cc
index 022edfc9fc9a209206a89427b93224bdde3f8b15..b5cc150916f1d6aae1483269d35b19b72dd85a35 100644
--- a/components/password_manager/core/browser/affiliation_utils_unittest.cc
+++ b/components/password_manager/core/browser/affiliation_utils_unittest.cc
@@ -372,4 +372,29 @@ TEST_F(GetHumanReadableOriginTest, OriginFromAndroidForm) {
"android://com.example.android");
}
+TEST(GetShownOriginTest, RemovePrefixes) {
+ struct {
+ std::string input;
+ std::string output;
+ } kTestCases[] = {
+ {"http://subdomain.example.com:80/login/index.html?h=90&ind=hello#first",
+ "subdomain.example.com"},
+ {"https://www.example.com", "example.com"},
+ {"https://mobile.example.com", "example.com"},
+ {"https://m.example.com", "example.com"},
+ {"https://m.subdomain.example.net", "subdomain.example.net"},
+ {"https://mobile.de", "mobile.de"},
+ {"https://www.de", "www.de"},
+ {"https://m.de", "m.de"},
+ {"https://www.mobile.de", "mobile.de"},
+ {"https://m.mobile.de", "mobile.de"},
+ {"https://m.www.de", "www.de"},
+ {"https://Mobile.example.de", "example.de"},
+ {"https://WWW.Example.DE", "example.de"}};
+
+ for (const auto& test_case : kTestCases) {
+ EXPECT_EQ(GetShownOrigin(GURL(test_case.input), ""), test_case.output);
vabr (Chromium) 2015/10/15 11:58:26 Please also add the input to the error logs: EXPE
vabr (Chromium) 2015/10/15 11:58:26 nit: The expected value goes first, so that EXPECT
kolos1 2015/10/16 14:19:25 Done.
kolos1 2015/10/16 14:19:26 Done.
+ }
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698