This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Search] Identity check for New Tab Page should use canonicalized form
Was causing a bug where identities were slightly different. BUG=453792 Review URL: https://codereview.chromium.org/864223006 Cr-Commit-Position: refs/heads/master@{#313955} (cherry picked from commit ed8d517) Review URL: https://codereview.chromium.org/886233003 Cr-Commit-Position: refs/branch-heads/2272@{#172} Cr-Branched-From: 827a380-refs/heads/master@{#310958}
- Loading branch information
Mathieu Perreault
committed
Jan 31, 2015
1 parent
1e87387
commit 2ddc774
Showing
3 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,6 +193,53 @@ TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMatch) { | |
ASSERT_TRUE(get<1>(params)); | ||
} | ||
|
||
TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMatchSlightlyDifferentGmail) { | ||
NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | ||
CreateSigninManager(std::string("[email protected]")); | ||
SearchTabHelper* search_tab_helper = | ||
SearchTabHelper::FromWebContents(web_contents()); | ||
ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | ||
|
||
// For gmail, canonicalization is done so that email addresses have a | ||
// standard form. | ||
const base::string16 test_identity = | ||
base::ASCIIToUTF16("[email protected]"); | ||
search_tab_helper->OnChromeIdentityCheck(test_identity); | ||
|
||
const IPC::Message* message = process()->sink().GetUniqueMessageMatching( | ||
ChromeViewMsg_ChromeIdentityCheckResult::ID); | ||
ASSERT_TRUE(message != NULL); | ||
|
||
ChromeViewMsg_ChromeIdentityCheckResult::Param params; | ||
ChromeViewMsg_ChromeIdentityCheckResult::Read(message, ¶ms); | ||
EXPECT_EQ(test_identity, get<0>(params)); | ||
ASSERT_TRUE(get<1>(params)); | ||
} | ||
|
||
TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMatchSlightlyDifferentGmail2) { | ||
NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | ||
// | ||
CreateSigninManager(std::string("chrome.guy.7FOREVER")); | ||
SearchTabHelper* search_tab_helper = | ||
SearchTabHelper::FromWebContents(web_contents()); | ||
ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | ||
|
||
// For gmail/googlemail, canonicalization is done so that email addresses have | ||
// a standard form. | ||
const base::string16 test_identity = | ||
base::ASCIIToUTF16("[email protected]"); | ||
search_tab_helper->OnChromeIdentityCheck(test_identity); | ||
|
||
const IPC::Message* message = process()->sink().GetUniqueMessageMatching( | ||
ChromeViewMsg_ChromeIdentityCheckResult::ID); | ||
ASSERT_TRUE(message != NULL); | ||
|
||
ChromeViewMsg_ChromeIdentityCheckResult::Param params; | ||
ChromeViewMsg_ChromeIdentityCheckResult::Read(message, ¶ms); | ||
EXPECT_EQ(test_identity, get<0>(params)); | ||
ASSERT_TRUE(get<1>(params)); | ||
} | ||
|
||
TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMismatch) { | ||
NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | ||
CreateSigninManager(std::string("[email protected]")); | ||
|