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

Unified Diff: chrome/browser/ui/search/search_tab_helper_unittest.cc

Issue 864223006: [Search] Identity check for New Tab Page should use canonicalized form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper_unittest.cc
diff --git a/chrome/browser/ui/search/search_tab_helper_unittest.cc b/chrome/browser/ui/search/search_tab_helper_unittest.cc
index 0264ae2118037290355e275194633a6cae08ef2a..8b3f7789f3a68c6f432440da942cf6b4094c8cbd 100644
--- a/chrome/browser/ui/search/search_tab_helper_unittest.cc
+++ b/chrome/browser/ui/search/search_tab_helper_unittest.cc
@@ -193,6 +193,53 @@ TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMatch) {
ASSERT_TRUE(get<1>(params));
}
+TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMatchSlightlyDifferentGmail) {
+ NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl));
+ CreateSigninManager(std::string("foobar123@gmail.com"));
+ 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("Foo.Bar.123@gmail.com");
+ 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, &params);
+ 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("chromeguy7forever@googlemail.com");
+ 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, &params);
+ EXPECT_EQ(test_identity, get<0>(params));
+ ASSERT_TRUE(get<1>(params));
+}
+
TEST_F(SearchTabHelperTest, OnChromeIdentityCheckMismatch) {
NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl));
CreateSigninManager(std::string("foo@bar.com"));
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698