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

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

Issue 2042033003: Displaying human-readable Android credentials on Android OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added #include <algorithm> to the files it was missing from. Created 4 years, 6 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/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
index 780fa8c50e468c9fde8c98658af768d3efbd845c..6d7e0748b8d444ecee8f980dd1513021d81934d0 100644
--- a/components/password_manager/core/browser/password_ui_utils_unittest.cc
+++ b/components/password_manager/core/browser/password_ui_utils_unittest.cc
@@ -93,4 +93,16 @@ TEST(GetShownOriginAndLinkUrlTest, OriginFromNonAndroidForm) {
EXPECT_EQ(form.origin, link_url);
}
+TEST(SplitByDotAndReverseTest, ReversedHostname) {
+ const struct {
+ const base::StringPiece input;
Bernhard Bauer 2016/06/13 09:55:07 Just FYI: In unit tests we don't care so much, but
vabr (Chromium) 2016/06/13 10:01:03 But here there is no static variable, kTestCases i
Bernhard Bauer 2016/06/13 10:34:01 (Which is also a thing I would avoid in production
dozsa 2016/06/13 12:36:18 Done.
+ const std::string output;
+ } kTestCases[] = {{"com.example.android", "android.example.com"},
+ {"com.example.mobile", "mobile.example.com"},
+ {"net.example.subdomain", "subdomain.example.net"}};
+ for (const auto& test_case : kTestCases) {
Bernhard Bauer 2016/06/13 09:34:59 FWIW, I think in this case you'd be better served
vabr (Chromium) 2016/06/13 09:45:21 Bernhard, this seems to be the case already. EXPEC
Bernhard Bauer 2016/06/13 09:55:07 Yes, but it will print the unevaluated arguments l
vabr (Chromium) 2016/06/13 10:01:03 But there is no advantage in that, as long as Spli
Bernhard Bauer 2016/06/13 10:34:01 I personally would find it more readable than havi
dozsa 2016/06/13 12:36:18 I used the unit test for GetShownOrigin as a model
+ EXPECT_EQ(test_case.output, SplitByDotAndReverse(test_case.input));
+ }
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698