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

Side by Side Diff: chrome/browser/chromeos/login/authenticator_unittest.cc

Issue 6089004: [Chrome OS] Respect periods in google apps account names (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address avayvod comments Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/authenticator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/authenticator.h" 5 #include "chrome/browser/chromeos/login/authenticator.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace chromeos { 9 namespace chromeos {
10 10
11 TEST(AuthenticatorTest, EmailAddressNoOp) { 11 TEST(AuthenticatorTest, EmailAddressNoOp) {
12 const char lower_case[] = "user@what.com"; 12 const char lower_case[] = "user@what.com";
13 EXPECT_EQ(lower_case, Authenticator::Canonicalize(lower_case)); 13 EXPECT_EQ(lower_case, Authenticator::Canonicalize(lower_case));
14 } 14 }
15 15
16 TEST(AuthenticatorTest, EmailAddressIgnoreCaps) { 16 TEST(AuthenticatorTest, EmailAddressIgnoreCaps) {
17 EXPECT_EQ(Authenticator::Canonicalize("user@what.com"), 17 EXPECT_EQ(Authenticator::Canonicalize("user@what.com"),
18 Authenticator::Canonicalize("UsEr@what.com")); 18 Authenticator::Canonicalize("UsEr@what.com"));
19 } 19 }
20 20
21 TEST(AuthenticatorTest, EmailAddressIgnoreDomainCaps) { 21 TEST(AuthenticatorTest, EmailAddressIgnoreDomainCaps) {
22 EXPECT_EQ(Authenticator::Canonicalize("user@what.com"), 22 EXPECT_EQ(Authenticator::Canonicalize("user@what.com"),
23 Authenticator::Canonicalize("UsEr@what.COM")); 23 Authenticator::Canonicalize("UsEr@what.COM"));
24 } 24 }
25 25
26 TEST(AuthenticatorTest, EmailAddressIgnoreOneUsernameDot) { 26 TEST(AuthenticatorTest, EmailAddressRejectOneUsernameDot) {
27 EXPECT_EQ(Authenticator::Canonicalize("us.er@what.com"), 27 EXPECT_NE(Authenticator::Canonicalize("u.ser@what.com"),
28 Authenticator::Canonicalize("UsEr@what.com")); 28 Authenticator::Canonicalize("UsEr@what.com"));
29 } 29 }
30 30
31 TEST(AuthenticatorTest, EmailAddressMatchWithOneUsernameDot) {
32 EXPECT_EQ(Authenticator::Canonicalize("u.ser@what.com"),
33 Authenticator::Canonicalize("U.sEr@what.com"));
34 }
35
36 TEST(AuthenticatorTest, EmailAddressIgnoreOneUsernameDot) {
37 EXPECT_EQ(Authenticator::Canonicalize("us.er@gmail.com"),
38 Authenticator::Canonicalize("UsEr@gmail.com"));
39 }
40
31 TEST(AuthenticatorTest, EmailAddressIgnoreManyUsernameDots) { 41 TEST(AuthenticatorTest, EmailAddressIgnoreManyUsernameDots) {
32 EXPECT_EQ(Authenticator::Canonicalize("u.ser@what.com"), 42 EXPECT_EQ(Authenticator::Canonicalize("u.ser@gmail.com"),
33 Authenticator::Canonicalize("Us.E.r@what.com")); 43 Authenticator::Canonicalize("Us.E.r@gmail.com"));
34 } 44 }
35 45
36 TEST(AuthenticatorTest, EmailAddressIgnoreConsecutiveUsernameDots) { 46 TEST(AuthenticatorTest, EmailAddressIgnoreConsecutiveUsernameDots) {
37 EXPECT_EQ(Authenticator::Canonicalize("use.r@what.com"), 47 EXPECT_EQ(Authenticator::Canonicalize("use.r@gmail.com"),
38 Authenticator::Canonicalize("Us....E.r@what.com")); 48 Authenticator::Canonicalize("Us....E.r@gmail.com"));
39 } 49 }
40 50
41 TEST(AuthenticatorTest, EmailAddressDifferentOnesRejected) { 51 TEST(AuthenticatorTest, EmailAddressDifferentOnesRejected) {
42 EXPECT_NE(Authenticator::Canonicalize("who@what.com"), 52 EXPECT_NE(Authenticator::Canonicalize("who@what.com"),
43 Authenticator::Canonicalize("Us....E.r@what.com")); 53 Authenticator::Canonicalize("Us....E.r@what.com"));
44 } 54 }
45 55
46 TEST(AuthenticatorTest, EmailAddressIgnorePlusSuffix) { 56 TEST(AuthenticatorTest, EmailAddressIgnorePlusSuffix) {
47 EXPECT_EQ(Authenticator::Canonicalize("user+cc@what.com"), 57 EXPECT_EQ(Authenticator::Canonicalize("user+cc@what.com"),
48 Authenticator::Canonicalize("user@what.com")); 58 Authenticator::Canonicalize("user@what.com"));
49 } 59 }
50 60
51 TEST(AuthenticatorTest, EmailAddressIgnoreMultiPlusSuffix) { 61 TEST(AuthenticatorTest, EmailAddressIgnoreMultiPlusSuffix) {
52 EXPECT_EQ(Authenticator::Canonicalize("user+cc+bcc@what.com"), 62 EXPECT_EQ(Authenticator::Canonicalize("user+cc+bcc@what.com"),
53 Authenticator::Canonicalize("user@what.com")); 63 Authenticator::Canonicalize("user@what.com"));
54 } 64 }
55 65
56 } // namespace chromeos 66 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/authenticator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698