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

Side by Side Diff: google_apis/gaia/gaia_auth_util_unittest.cc

Issue 11091048: Add helper function to test that a given URL is a valid Gaia sign in URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 2 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 | « google_apis/gaia/gaia_auth_util.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) 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 "google_apis/gaia/gaia_auth_util.h" 5 #include "google_apis/gaia/gaia_auth_util.h"
6 6
7 #include "googleurl/src/gurl.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace gaia { 10 namespace gaia {
10 11
11 TEST(GaiaAuthUtilTest, EmailAddressNoOp) { 12 TEST(GaiaAuthUtilTest, EmailAddressNoOp) {
12 const char lower_case[] = "user@what.com"; 13 const char lower_case[] = "user@what.com";
13 EXPECT_EQ(lower_case, CanonicalizeEmail(lower_case)); 14 EXPECT_EQ(lower_case, CanonicalizeEmail(lower_case));
14 } 15 }
15 16
16 TEST(GaiaAuthUtilTest, EmailAddressIgnoreCaps) { 17 TEST(GaiaAuthUtilTest, EmailAddressIgnoreCaps) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 TEST(GaiaAuthUtilTest, SanitizeMissingDomain) { 79 TEST(GaiaAuthUtilTest, SanitizeMissingDomain) {
79 EXPECT_EQ("nodomain@gmail.com", SanitizeEmail("nodomain")); 80 EXPECT_EQ("nodomain@gmail.com", SanitizeEmail("nodomain"));
80 } 81 }
81 82
82 TEST(GaiaAuthUtilTest, SanitizeExistingDomain) { 83 TEST(GaiaAuthUtilTest, SanitizeExistingDomain) {
83 const char existing[] = "test@example.com"; 84 const char existing[] = "test@example.com";
84 EXPECT_EQ(existing, SanitizeEmail(existing)); 85 EXPECT_EQ(existing, SanitizeEmail(existing));
85 } 86 }
86 87
88 TEST(GaiaAuthUtilTest, IsGaiaSignonRealm) {
89 // Only https versions of Gaia URLs should be considered valid.
90 EXPECT_TRUE(IsGaiaSignonRealm(GURL("https://accounts.google.com/")));
91 EXPECT_TRUE(IsGaiaSignonRealm(GURL("https://www.google.com/")));
92 EXPECT_FALSE(IsGaiaSignonRealm(GURL("http://accounts.google.com/")));
93 EXPECT_FALSE(IsGaiaSignonRealm(GURL("http://www.google.com/")));
94
95 // Other Google URLs are not valid.
96 EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://google.com/")));
97 EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://mail.google.com/")));
98
99 // Other https URLs are not valid.
100 EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://www.example.com/")));
101 }
102
87 } // namespace gaia 103 } // namespace gaia
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_auth_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698