| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/signin/signin_manager.h" | 9 #include "chrome/browser/signin/signin_manager.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_ProcessIsolation) { | 105 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_ProcessIsolation) { |
| 106 SigninManager* signin = SigninManagerFactory::GetForProfile( | 106 SigninManager* signin = SigninManagerFactory::GetForProfile( |
| 107 browser()->profile()); | 107 browser()->profile()); |
| 108 EXPECT_FALSE(signin->HasSigninProcess()); | 108 EXPECT_FALSE(signin->HasSigninProcess()); |
| 109 | 109 |
| 110 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( | 110 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( |
| 111 signin::SOURCE_NTP_LINK, true)); | 111 signin::SOURCE_NTP_LINK, true)); |
| 112 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); | 112 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); |
| 113 | 113 |
| 114 // Navigating away should change the process. | 114 // Navigating away should change the process. |
| 115 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 115 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIOmniboxURL)); |
| 116 EXPECT_FALSE(signin->HasSigninProcess()); | 116 EXPECT_FALSE(signin->HasSigninProcess()); |
| 117 | 117 |
| 118 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( | 118 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( |
| 119 signin::SOURCE_NTP_LINK, true)); | 119 signin::SOURCE_NTP_LINK, true)); |
| 120 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); | 120 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); |
| 121 | 121 |
| 122 content::WebContents* active_tab = | 122 content::WebContents* active_tab = |
| 123 browser()->tab_strip_model()->GetActiveWebContents(); | 123 browser()->tab_strip_model()->GetActiveWebContents(); |
| 124 int active_tab_process_id = | 124 int active_tab_process_id = |
| 125 active_tab->GetRenderProcessHost()->GetID(); | 125 active_tab->GetRenderProcessHost()->GetID(); |
| 126 EXPECT_EQ(kOneClickSigninEnabled, | 126 EXPECT_EQ(kOneClickSigninEnabled, |
| 127 signin->IsSigninProcess(active_tab_process_id)); | 127 signin->IsSigninProcess(active_tab_process_id)); |
| 128 EXPECT_EQ(0, active_tab->GetRenderViewHost()->GetEnabledBindings()); | 128 EXPECT_EQ(0, active_tab->GetRenderViewHost()->GetEnabledBindings()); |
| 129 | 129 |
| 130 // Entry points to signin request "SINGLETON_TAB" mode, so a new request | 130 // Entry points to signin request "SINGLETON_TAB" mode, so a new request |
| 131 // shouldn't change anything. | 131 // shouldn't change anything. |
| 132 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 132 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 133 browser(), | 133 browser(), |
| 134 GURL(signin::GetPromoURL(signin::SOURCE_NTP_LINK, false)))); | 134 GURL(signin::GetPromoURL(signin::SOURCE_NTP_LINK, false)))); |
| 135 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 135 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 136 ShowSingletonTabOverwritingNTP(browser(), params); | 136 ShowSingletonTabOverwritingNTP(browser(), params); |
| 137 EXPECT_EQ(active_tab, browser()->tab_strip_model()->GetActiveWebContents()); | 137 EXPECT_EQ(active_tab, browser()->tab_strip_model()->GetActiveWebContents()); |
| 138 EXPECT_EQ(kOneClickSigninEnabled, | 138 EXPECT_EQ(kOneClickSigninEnabled, |
| 139 signin->IsSigninProcess(active_tab_process_id)); | 139 signin->IsSigninProcess(active_tab_process_id)); |
| 140 | 140 |
| 141 // Navigating away should change the process. | 141 // Navigating away should change the process. |
| 142 ui_test_utils::NavigateToURL(browser(), GURL(kNonSigninURL)); | 142 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 143 EXPECT_FALSE(signin->IsSigninProcess( | 143 EXPECT_FALSE(signin->IsSigninProcess( |
| 144 active_tab->GetRenderProcessHost()->GetID())); | 144 active_tab->GetRenderProcessHost()->GetID())); |
| 145 } | 145 } |
| 146 | 146 |
| 147 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, NotTrustedAfterRedirect) { | 147 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, NotTrustedAfterRedirect) { |
| 148 SigninManager* signin = SigninManagerFactory::GetForProfile( | 148 SigninManager* signin = SigninManagerFactory::GetForProfile( |
| 149 browser()->profile()); | 149 browser()->profile()); |
| 150 EXPECT_FALSE(signin->HasSigninProcess()); | 150 EXPECT_FALSE(signin->HasSigninProcess()); |
| 151 | 151 |
| 152 GURL url = signin::GetPromoURL(signin::SOURCE_NTP_LINK, true); | 152 GURL url = signin::GetPromoURL(signin::SOURCE_NTP_LINK, true); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 172 : content::WebContentsObserver(web_contents) { | 172 : content::WebContentsObserver(web_contents) { |
| 173 } | 173 } |
| 174 | 174 |
| 175 virtual void DidCommitProvisionalLoadForFrame( | 175 virtual void DidCommitProvisionalLoadForFrame( |
| 176 int64 frame_id, | 176 int64 frame_id, |
| 177 const string16& frame_unique_name, | 177 const string16& frame_unique_name, |
| 178 bool is_main_frame, | 178 bool is_main_frame, |
| 179 const GURL& url, | 179 const GURL& url, |
| 180 content::PageTransition transition_type, | 180 content::PageTransition transition_type, |
| 181 content::RenderViewHost* render_view_host) OVERRIDE { | 181 content::RenderViewHost* render_view_host) OVERRIDE { |
| 182 if (url == GURL(chrome::kChromeUINewTabURL)) { | 182 if (url == GURL(chrome::kChromeUINewTabURL) || |
| 183 url == GURL(chrome::kChromeSearchLocalNtpUrl)) { |
| 183 content::WindowedNotificationObserver observer( | 184 content::WindowedNotificationObserver observer( |
| 184 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 185 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 185 content::NotificationService::AllSources()); | 186 content::NotificationService::AllSources()); |
| 186 web_contents()->GetController().GoBack(); | 187 web_contents()->GetController().GoBack(); |
| 187 observer.Wait(); | 188 observer.Wait(); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 private: | 192 private: |
| 192 DISALLOW_COPY_AND_ASSIGN(BackOnNTPCommitObserver); | 193 DISALLOW_COPY_AND_ASSIGN(BackOnNTPCommitObserver); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); | 234 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); |
| 234 EXPECT_EQ(ntp_url, web_contents->GetVisibleURL()); | 235 EXPECT_EQ(ntp_url, web_contents->GetVisibleURL()); |
| 235 | 236 |
| 236 content::WindowedNotificationObserver observer( | 237 content::WindowedNotificationObserver observer( |
| 237 content::NOTIFICATION_LOAD_STOP, | 238 content::NOTIFICATION_LOAD_STOP, |
| 238 content::NotificationService::AllSources()); | 239 content::NotificationService::AllSources()); |
| 239 observer.Wait(); | 240 observer.Wait(); |
| 240 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); | 241 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
| 241 } | 242 } |
| 242 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 243 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
| OLD | NEW |