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/chrome_signin_client.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
11 #include "chrome/browser/signin/signin_promo.h" | 11 #include "chrome/browser/signin/signin_promo.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/singleton_tabs.h" | 13 #include "chrome/browser/ui/singleton_tabs.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const bool kOneClickSigninEnabled = false; | 100 const bool kOneClickSigninEnabled = false; |
101 #endif | 101 #endif |
102 | 102 |
103 // Disabled on Windows due to flakiness. http://crbug.com/249055 | 103 // Disabled on Windows due to flakiness. http://crbug.com/249055 |
104 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
105 #define MAYBE_ProcessIsolation DISABLED_ProcessIsolation | 105 #define MAYBE_ProcessIsolation DISABLED_ProcessIsolation |
106 #else | 106 #else |
107 #define MAYBE_ProcessIsolation ProcessIsolation | 107 #define MAYBE_ProcessIsolation ProcessIsolation |
108 #endif | 108 #endif |
109 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_ProcessIsolation) { | 109 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_ProcessIsolation) { |
110 SigninManager* signin = SigninManagerFactory::GetForProfile( | 110 ChromeSigninClient* signin = |
111 browser()->profile()); | 111 ChromeSigninClientFactory::GetForProfile(browser()->profile()); |
112 EXPECT_FALSE(signin->HasSigninProcess()); | 112 EXPECT_FALSE(signin->HasSigninProcess()); |
113 | 113 |
114 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( | 114 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( |
115 signin::SOURCE_NTP_LINK, true)); | 115 signin::SOURCE_NTP_LINK, true)); |
116 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); | 116 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); |
117 | 117 |
118 // Navigating away should change the process. | 118 // Navigating away should change the process. |
119 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIOmniboxURL)); | 119 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIOmniboxURL)); |
120 EXPECT_FALSE(signin->HasSigninProcess()); | 120 EXPECT_FALSE(signin->HasSigninProcess()); |
121 | 121 |
(...skipping 20 matching lines...) Expand all Loading... |
142 EXPECT_EQ(kOneClickSigninEnabled, | 142 EXPECT_EQ(kOneClickSigninEnabled, |
143 signin->IsSigninProcess(active_tab_process_id)); | 143 signin->IsSigninProcess(active_tab_process_id)); |
144 | 144 |
145 // Navigating away should change the process. | 145 // Navigating away should change the process. |
146 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 146 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
147 EXPECT_FALSE(signin->IsSigninProcess( | 147 EXPECT_FALSE(signin->IsSigninProcess( |
148 active_tab->GetRenderProcessHost()->GetID())); | 148 active_tab->GetRenderProcessHost()->GetID())); |
149 } | 149 } |
150 | 150 |
151 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, NotTrustedAfterRedirect) { | 151 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, NotTrustedAfterRedirect) { |
152 SigninManager* signin = SigninManagerFactory::GetForProfile( | 152 ChromeSigninClient* signin = |
153 browser()->profile()); | 153 ChromeSigninClientFactory::GetForProfile(browser()->profile()); |
154 EXPECT_FALSE(signin->HasSigninProcess()); | 154 EXPECT_FALSE(signin->HasSigninProcess()); |
155 | 155 |
156 GURL url = signin::GetPromoURL(signin::SOURCE_NTP_LINK, true); | 156 GURL url = signin::GetPromoURL(signin::SOURCE_NTP_LINK, true); |
157 ui_test_utils::NavigateToURL(browser(), url); | 157 ui_test_utils::NavigateToURL(browser(), url); |
158 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); | 158 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); |
159 | 159 |
160 // Navigating in a different tab should not affect the sign-in process. | 160 // Navigating in a different tab should not affect the sign-in process. |
161 ui_test_utils::NavigateToURLWithDisposition( | 161 ui_test_utils::NavigateToURLWithDisposition( |
162 browser(), GURL(kNonSigninURL), NEW_BACKGROUND_TAB, | 162 browser(), GURL(kNonSigninURL), NEW_BACKGROUND_TAB, |
163 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 163 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 // This is a test for http://crbug.com/257277. It simulates the navigations | 200 // This is a test for http://crbug.com/257277. It simulates the navigations |
201 // that occur if the user clicks on the "Skip for now" link at the signin page | 201 // that occur if the user clicks on the "Skip for now" link at the signin page |
202 // and initiates a back navigation between the point of Commit and | 202 // and initiates a back navigation between the point of Commit and |
203 // DidStopLoading of the NTP. | 203 // DidStopLoading of the NTP. |
204 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, SigninSkipForNowAndGoBack) { | 204 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, SigninSkipForNowAndGoBack) { |
205 GURL ntp_url(chrome::kChromeUINewTabURL); | 205 GURL ntp_url(chrome::kChromeUINewTabURL); |
206 GURL start_url = signin::GetPromoURL(signin::SOURCE_START_PAGE, true); | 206 GURL start_url = signin::GetPromoURL(signin::SOURCE_START_PAGE, true); |
207 GURL skip_url = signin::GetLandingURL("ntp", 1); | 207 GURL skip_url = signin::GetLandingURL("ntp", 1); |
208 | 208 |
209 SigninManager* signin = SigninManagerFactory::GetForProfile( | 209 ChromeSigninClient* signin = |
210 browser()->profile()); | 210 ChromeSigninClientFactory::GetForProfile(browser()->profile()); |
211 EXPECT_FALSE(signin->HasSigninProcess()); | 211 EXPECT_FALSE(signin->HasSigninProcess()); |
212 | 212 |
213 ui_test_utils::NavigateToURL(browser(), start_url); | 213 ui_test_utils::NavigateToURL(browser(), start_url); |
214 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); | 214 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); |
215 | 215 |
216 content::WebContents* web_contents = | 216 content::WebContents* web_contents = |
217 browser()->tab_strip_model()->GetActiveWebContents(); | 217 browser()->tab_strip_model()->GetActiveWebContents(); |
218 | 218 |
219 // Simulate clicking on the Skip for now link. It's important to have a | 219 // Simulate clicking on the Skip for now link. It's important to have a |
220 // link transition so that OneClickSigninHelper removes the blank page | 220 // link transition so that OneClickSigninHelper removes the blank page |
(...skipping 17 matching lines...) Expand all Loading... |
238 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); | 238 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); |
239 EXPECT_EQ(ntp_url, web_contents->GetVisibleURL()); | 239 EXPECT_EQ(ntp_url, web_contents->GetVisibleURL()); |
240 | 240 |
241 content::WindowedNotificationObserver observer( | 241 content::WindowedNotificationObserver observer( |
242 content::NOTIFICATION_LOAD_STOP, | 242 content::NOTIFICATION_LOAD_STOP, |
243 content::NotificationService::AllSources()); | 243 content::NotificationService::AllSources()); |
244 observer.Wait(); | 244 observer.Wait(); |
245 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); | 245 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
246 } | 246 } |
247 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 247 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
OLD | NEW |