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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/authenticator.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace chromeos {
10
11 TEST(AuthenticatorTest, EmailAddressNoOp) {
12 const char lower_case[] = "user@what.com";
13 EXPECT_EQ(lower_case, Authenticator::Canonicalize(lower_case));
14 }
15
16 TEST(AuthenticatorTest, EmailAddressIgnoreCaps) {
17 EXPECT_EQ(Authenticator::Canonicalize("user@what.com"),
18 Authenticator::Canonicalize("UsEr@what.com"));
19 }
20
21 TEST(AuthenticatorTest, EmailAddressIgnoreDomainCaps) {
22 EXPECT_EQ(Authenticator::Canonicalize("user@what.com"),
23 Authenticator::Canonicalize("UsEr@what.COM"));
24 }
25
26 TEST(AuthenticatorTest, EmailAddressIgnoreOneUsernameDot) {
27 EXPECT_EQ(Authenticator::Canonicalize("us.er@what.com"),
28 Authenticator::Canonicalize("UsEr@what.com"));
29 }
30
31 TEST(AuthenticatorTest, EmailAddressIgnoreManyUsernameDots) {
32 EXPECT_EQ(Authenticator::Canonicalize("u.ser@what.com"),
33 Authenticator::Canonicalize("Us.E.r@what.com"));
34 }
35
36 TEST(AuthenticatorTest, EmailAddressIgnoreConsecutiveUsernameDots) {
37 EXPECT_EQ(Authenticator::Canonicalize("use.r@what.com"),
38 Authenticator::Canonicalize("Us....E.r@what.com"));
39 }
40
41 TEST(AuthenticatorTest, EmailAddressDifferentOnesRejected) {
42 EXPECT_NE(Authenticator::Canonicalize("who@what.com"),
43 Authenticator::Canonicalize("Us....E.r@what.com"));
44 }
45
46 TEST(AuthenticatorTest, EmailAddressIgnorePlusSuffix) {
47 EXPECT_EQ(Authenticator::Canonicalize("user+cc@what.com"),
48 Authenticator::Canonicalize("user@what.com"));
49 }
50
51 TEST(AuthenticatorTest, EmailAddressIgnoreMultiPlusSuffix) {
52 EXPECT_EQ(Authenticator::Canonicalize("user+cc+bcc@what.com"),
53 Authenticator::Canonicalize("user@what.com"));
54 }
55
56 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698