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

Side by Side Diff: chrome/common/net/gaia/gaia_auth_util_unittest.cc

Issue 10928017: Moving google_apis and GaiaClient to src/google_apis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_util.cc ('k') | chrome/common/net/gaia/gaia_authenticator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/common/net/gaia/gaia_auth_util.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace gaia {
10
11 TEST(GaiaAuthUtilTest, EmailAddressNoOp) {
12 const char lower_case[] = "user@what.com";
13 EXPECT_EQ(lower_case, CanonicalizeEmail(lower_case));
14 }
15
16 TEST(GaiaAuthUtilTest, EmailAddressIgnoreCaps) {
17 EXPECT_EQ(CanonicalizeEmail("user@what.com"),
18 CanonicalizeEmail("UsEr@what.com"));
19 }
20
21 TEST(GaiaAuthUtilTest, EmailAddressIgnoreDomainCaps) {
22 EXPECT_EQ(CanonicalizeEmail("user@what.com"),
23 CanonicalizeEmail("UsEr@what.COM"));
24 }
25
26 TEST(GaiaAuthUtilTest, EmailAddressRejectOneUsernameDot) {
27 EXPECT_NE(CanonicalizeEmail("u.ser@what.com"),
28 CanonicalizeEmail("UsEr@what.com"));
29 }
30
31 TEST(GaiaAuthUtilTest, EmailAddressMatchWithOneUsernameDot) {
32 EXPECT_EQ(CanonicalizeEmail("u.ser@what.com"),
33 CanonicalizeEmail("U.sEr@what.com"));
34 }
35
36 TEST(GaiaAuthUtilTest, EmailAddressIgnoreOneUsernameDot) {
37 EXPECT_EQ(CanonicalizeEmail("us.er@gmail.com"),
38 CanonicalizeEmail("UsEr@gmail.com"));
39 }
40
41 TEST(GaiaAuthUtilTest, EmailAddressIgnoreManyUsernameDots) {
42 EXPECT_EQ(CanonicalizeEmail("u.ser@gmail.com"),
43 CanonicalizeEmail("Us.E.r@gmail.com"));
44 }
45
46 TEST(GaiaAuthUtilTest, EmailAddressIgnoreConsecutiveUsernameDots) {
47 EXPECT_EQ(CanonicalizeEmail("use.r@gmail.com"),
48 CanonicalizeEmail("Us....E.r@gmail.com"));
49 }
50
51 TEST(GaiaAuthUtilTest, EmailAddressDifferentOnesRejected) {
52 EXPECT_NE(CanonicalizeEmail("who@what.com"),
53 CanonicalizeEmail("Us....E.r@what.com"));
54 }
55
56 TEST(GaiaAuthUtilTest, EmailAddressIgnorePlusSuffix) {
57 const char with_plus[] = "user+cc@what.com";
58 EXPECT_EQ(with_plus, CanonicalizeEmail(with_plus));
59 }
60
61 TEST(GaiaAuthUtilTest, EmailAddressIgnoreMultiPlusSuffix) {
62 const char multi_plus[] = "user+cc+bcc@what.com";
63 EXPECT_EQ(multi_plus, CanonicalizeEmail(multi_plus));
64 }
65
66 TEST(GaiaAuthUtilTest, CanonicalizeDomain) {
67 const char domain[] = "example.com";
68 EXPECT_EQ(domain, CanonicalizeDomain("example.com"));
69 EXPECT_EQ(domain, CanonicalizeDomain("EXAMPLE.cOm"));
70 }
71
72 TEST(GaiaAuthUtilTest, ExtractDomainName) {
73 const char domain[] = "example.com";
74 EXPECT_EQ(domain, ExtractDomainName("who@example.com"));
75 EXPECT_EQ(domain, ExtractDomainName("who@EXAMPLE.cOm"));
76 }
77
78 TEST(GaiaAuthUtilTest, SanitizeMissingDomain) {
79 EXPECT_EQ("nodomain@gmail.com", SanitizeEmail("nodomain"));
80 }
81
82 TEST(GaiaAuthUtilTest, SanitizeExistingDomain) {
83 const char existing[] = "test@example.com";
84 EXPECT_EQ(existing, SanitizeEmail(existing));
85 }
86
87 } // namespace gaia
OLDNEW
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_util.cc ('k') | chrome/common/net/gaia/gaia_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698