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

Side by Side Diff: chrome/browser/signin/signin_browsertest.cc

Issue 807503004: While trying to enable webview sign-in by default, I found a bunch of issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years 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
OLDNEW
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/chrome_signin_client.h" 9 #include "chrome/browser/signin/chrome_signin_client.h"
10 #include "chrome/browser/signin/chrome_signin_client_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"
21 #include "components/signin/core/common/profile_management_switches.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_types.h" 23 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/render_view_host.h" 25 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "content/public/browser/web_contents_observer.h" 27 #include "content/public/browser/web_contents_observer.h"
27 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
28 #include "google_apis/gaia/gaia_urls.h" 29 #include "google_apis/gaia/gaia_urls.h"
29 #include "net/http/http_status_code.h" 30 #include "net/http/http_status_code.h"
30 #include "net/url_request/test_url_fetcher_factory.h" 31 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const bool kOneClickSigninEnabled = false; 101 const bool kOneClickSigninEnabled = false;
101 #endif 102 #endif
102 103
103 // Disabled on Windows due to flakiness. http://crbug.com/249055 104 // Disabled on Windows due to flakiness. http://crbug.com/249055
104 #if defined(OS_WIN) 105 #if defined(OS_WIN)
105 #define MAYBE_ProcessIsolation DISABLED_ProcessIsolation 106 #define MAYBE_ProcessIsolation DISABLED_ProcessIsolation
106 #else 107 #else
107 #define MAYBE_ProcessIsolation ProcessIsolation 108 #define MAYBE_ProcessIsolation ProcessIsolation
108 #endif 109 #endif
109 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_ProcessIsolation) { 110 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_ProcessIsolation) {
111 // This test is not needed for the webview based sign-in code.
112 if (switches::IsEnableWebviewBasedSignin())
113 return;
114
110 SigninClient* signin = 115 SigninClient* signin =
111 ChromeSigninClientFactory::GetForProfile(browser()->profile()); 116 ChromeSigninClientFactory::GetForProfile(browser()->profile());
112 EXPECT_FALSE(signin->HasSigninProcess()); 117 EXPECT_FALSE(signin->HasSigninProcess());
113 118
114 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL( 119 ui_test_utils::NavigateToURL(browser(), signin::GetPromoURL(
115 signin_metrics::SOURCE_NTP_LINK, true)); 120 signin_metrics::SOURCE_NTP_LINK, true));
116 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); 121 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess());
117 122
118 // Navigating away should change the process. 123 // Navigating away should change the process.
119 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIOmniboxURL)); 124 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIOmniboxURL));
(...skipping 29 matching lines...) Expand all
149 } 154 }
150 155
151 #if defined (OS_MACOSX) 156 #if defined (OS_MACOSX)
152 // crbug.com/375197 157 // crbug.com/375197
153 #define MAYBE_NotTrustedAfterRedirect DISABLED_NotTrustedAfterRedirect 158 #define MAYBE_NotTrustedAfterRedirect DISABLED_NotTrustedAfterRedirect
154 #else 159 #else
155 #define MAYBE_NotTrustedAfterRedirect NotTrustedAfterRedirect 160 #define MAYBE_NotTrustedAfterRedirect NotTrustedAfterRedirect
156 #endif 161 #endif
157 162
158 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_NotTrustedAfterRedirect) { 163 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_NotTrustedAfterRedirect) {
164 // This test is not needed for the webview based sign-in code.
165 if (switches::IsEnableWebviewBasedSignin())
166 return;
167
159 SigninClient* signin = 168 SigninClient* signin =
160 ChromeSigninClientFactory::GetForProfile(browser()->profile()); 169 ChromeSigninClientFactory::GetForProfile(browser()->profile());
161 EXPECT_FALSE(signin->HasSigninProcess()); 170 EXPECT_FALSE(signin->HasSigninProcess());
162 171
163 GURL url = signin::GetPromoURL(signin_metrics::SOURCE_NTP_LINK, true); 172 GURL url = signin::GetPromoURL(signin_metrics::SOURCE_NTP_LINK, true);
164 ui_test_utils::NavigateToURL(browser(), url); 173 ui_test_utils::NavigateToURL(browser(), url);
165 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); 174 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess());
166 175
167 // Navigating in a different tab should not affect the sign-in process. 176 // Navigating in a different tab should not affect the sign-in process.
168 ui_test_utils::NavigateToURLWithDisposition( 177 ui_test_utils::NavigateToURLWithDisposition(
(...skipping 30 matching lines...) Expand all
199 208
200 private: 209 private:
201 DISALLOW_COPY_AND_ASSIGN(BackOnNTPCommitObserver); 210 DISALLOW_COPY_AND_ASSIGN(BackOnNTPCommitObserver);
202 }; 211 };
203 212
204 // This is a test for http://crbug.com/257277. It simulates the navigations 213 // This is a test for http://crbug.com/257277. It simulates the navigations
205 // that occur if the user clicks on the "Skip for now" link at the signin page 214 // that occur if the user clicks on the "Skip for now" link at the signin page
206 // and initiates a back navigation between the point of Commit and 215 // and initiates a back navigation between the point of Commit and
207 // DidStopLoading of the NTP. 216 // DidStopLoading of the NTP.
208 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, SigninSkipForNowAndGoBack) { 217 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, SigninSkipForNowAndGoBack) {
218 // This test is not needed for the webview based sign-in code.
219 // OneClickSigninHelper is not used.
220 if (switches::IsEnableWebviewBasedSignin())
221 return;
222
209 GURL ntp_url(chrome::kChromeUINewTabURL); 223 GURL ntp_url(chrome::kChromeUINewTabURL);
210 GURL start_url = signin::GetPromoURL( 224 GURL start_url = signin::GetPromoURL(
211 signin_metrics::SOURCE_START_PAGE, false); 225 signin_metrics::SOURCE_START_PAGE, false);
212 GURL skip_url = signin::GetLandingURL("ntp", 1); 226 GURL skip_url = signin::GetLandingURL("ntp", 1);
213 227
214 SigninClient* signin = 228 SigninClient* signin =
215 ChromeSigninClientFactory::GetForProfile(browser()->profile()); 229 ChromeSigninClientFactory::GetForProfile(browser()->profile());
216 EXPECT_FALSE(signin->HasSigninProcess()); 230 EXPECT_FALSE(signin->HasSigninProcess());
217 231
218 ui_test_utils::NavigateToURL(browser(), start_url); 232 ui_test_utils::NavigateToURL(browser(), start_url);
(...skipping 23 matching lines...) Expand all
242 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); 256 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL());
243 EXPECT_EQ(start_url, web_contents->GetVisibleURL()); 257 EXPECT_EQ(start_url, web_contents->GetVisibleURL());
244 258
245 content::WindowedNotificationObserver observer( 259 content::WindowedNotificationObserver observer(
246 content::NOTIFICATION_LOAD_STOP, 260 content::NOTIFICATION_LOAD_STOP,
247 content::NotificationService::AllSources()); 261 content::NotificationService::AllSources());
248 observer.Wait(); 262 observer.Wait();
249 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); 263 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL());
250 } 264 }
251 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ 265 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698