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

Unified Diff: chrome/browser/chromeos/login/authenticator_unittest.cc

Issue 3436031: [Chrome OS] Refactor Canonicalize() method into base class to prepare for new Authenticator subclass (Closed)
Patch Set: aaaaand fix one more header Created 10 years, 3 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/chromeos/login/authenticator_unittest.cc
diff --git a/chrome/browser/chromeos/login/authenticator_unittest.cc b/chrome/browser/chromeos/login/authenticator_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..48ab3785ccc87b123e0642fe8cd08e9a8c5d4327
--- /dev/null
+++ b/chrome/browser/chromeos/login/authenticator_unittest.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 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 "chrome/browser/chromeos/login/authenticator.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace chromeos {
+
+TEST(AuthenticatorTest, EmailAddressNoOp) {
+ const char lower_case[] = "user@what.com";
+ EXPECT_EQ(lower_case, Authenticator::Canonicalize(lower_case));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreCaps) {
+ EXPECT_EQ(Authenticator::Canonicalize("user@what.com"),
+ Authenticator::Canonicalize("UsEr@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreDomainCaps) {
+ EXPECT_EQ(Authenticator::Canonicalize("user@what.com"),
+ Authenticator::Canonicalize("UsEr@what.COM"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreOneUsernameDot) {
+ EXPECT_EQ(Authenticator::Canonicalize("us.er@what.com"),
+ Authenticator::Canonicalize("UsEr@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreManyUsernameDots) {
+ EXPECT_EQ(Authenticator::Canonicalize("u.ser@what.com"),
+ Authenticator::Canonicalize("Us.E.r@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreConsecutiveUsernameDots) {
+ EXPECT_EQ(Authenticator::Canonicalize("use.r@what.com"),
+ Authenticator::Canonicalize("Us....E.r@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressDifferentOnesRejected) {
+ EXPECT_NE(Authenticator::Canonicalize("who@what.com"),
+ Authenticator::Canonicalize("Us....E.r@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnorePlusSuffix) {
+ EXPECT_EQ(Authenticator::Canonicalize("user+cc@what.com"),
+ Authenticator::Canonicalize("user@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreMultiPlusSuffix) {
+ EXPECT_EQ(Authenticator::Canonicalize("user+cc+bcc@what.com"),
+ Authenticator::Canonicalize("user@what.com"));
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698