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

Unified Diff: components/password_manager/core/browser/password_ui_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: Changes with StringPiece 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
« no previous file with comments | « components/password_manager/core/browser/password_ui_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_ui_utils_unittest.cc
diff --git a/components/password_manager/core/browser/password_ui_utils_unittest.cc b/components/password_manager/core/browser/password_ui_utils_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4af70178cee473f122c9c965309d65e17a9a3165
--- /dev/null
+++ b/components/password_manager/core/browser/password_ui_utils_unittest.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/password_ui_utils.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace password_manager {
+
+TEST(GetShownOriginTest, RemovePrefixes) {
+ const struct {
+ const std::string input;
+ const 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(test_case.output, GetShownOrigin(GURL(test_case.input), ""))
+ << "for input " << test_case.input;
+ }
+}
+
+} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/password_ui_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698