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

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

Issue 10443125: Allow re-enrollment to the same domain in case of policy data loss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 TEST(AuthenticatorTest, EmailAddressIgnorePlusSuffix) { 56 TEST(AuthenticatorTest, EmailAddressIgnorePlusSuffix) {
57 const char with_plus[] = "user+cc@what.com"; 57 const char with_plus[] = "user+cc@what.com";
58 EXPECT_EQ(with_plus, Authenticator::Canonicalize(with_plus)); 58 EXPECT_EQ(with_plus, Authenticator::Canonicalize(with_plus));
59 } 59 }
60 60
61 TEST(AuthenticatorTest, EmailAddressIgnoreMultiPlusSuffix) { 61 TEST(AuthenticatorTest, EmailAddressIgnoreMultiPlusSuffix) {
62 const char multi_plus[] = "user+cc+bcc@what.com"; 62 const char multi_plus[] = "user+cc+bcc@what.com";
63 EXPECT_EQ(multi_plus, Authenticator::Canonicalize(multi_plus)); 63 EXPECT_EQ(multi_plus, Authenticator::Canonicalize(multi_plus));
64 } 64 }
65 65
66 TEST(AuthenticatorTest, CanonicalizeDomain) {
67 const char domain[] = "example.com";
68 EXPECT_EQ(domain, Authenticator::CanonicalizeDomain("example.com"));
69 EXPECT_EQ(domain, Authenticator::CanonicalizeDomain("EXAMPLE.cOm"));
70 }
71
72 TEST(AuthenticatorTest, ExtractDomainName) {
73 const char domain[] = "example.com";
74 EXPECT_EQ(domain, Authenticator::ExtractDomainName("who@example.com"));
75 EXPECT_EQ(domain, Authenticator::ExtractDomainName("who@EXAMPLE.cOm"));
76 }
77
66 TEST(AuthenticatorTest, SanitizeMissingDomain) { 78 TEST(AuthenticatorTest, SanitizeMissingDomain) {
67 EXPECT_EQ("nodomain@gmail.com", Authenticator::Sanitize("nodomain")); 79 EXPECT_EQ("nodomain@gmail.com", Authenticator::Sanitize("nodomain"));
68 } 80 }
69 81
70 TEST(AuthenticatorTest, SanitizeExistingDomain) { 82 TEST(AuthenticatorTest, SanitizeExistingDomain) {
71 const char existing[] = "test@example.com"; 83 const char existing[] = "test@example.com";
72 EXPECT_EQ(existing, Authenticator::Sanitize(existing)); 84 EXPECT_EQ(existing, Authenticator::Sanitize(existing));
73 } 85 }
74 86
75 } // namespace chromeos 87 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698