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/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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
28 #include "google_apis/gaia/gaia_urls.h" | 28 #include "google_apis/gaia/gaia_urls.h" |
29 #include "net/http/http_status_code.h" | 29 #include "net/http/http_status_code.h" |
30 #include "net/url_request/test_url_fetcher_factory.h" | 30 #include "net/url_request/test_url_fetcher_factory.h" |
31 #include "net/url_request/url_request_status.h" | 31 #include "net/url_request/url_request_status.h" |
32 | 32 |
33 namespace { | 33 namespace { |
34 const char kNonSigninURL[] = "www.google.com"; | 34 const char kNonSigninURL[] = "http://www.google.com"; |
35 } | 35 } |
36 | 36 |
37 class SigninBrowserTest : public InProcessBrowserTest { | 37 class SigninBrowserTest : public InProcessBrowserTest { |
38 public: | 38 public: |
39 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 39 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
40 https_server_.reset(new net::SpawnedTestServer( | 40 https_server_.reset(new net::SpawnedTestServer( |
41 net::SpawnedTestServer::TYPE_HTTPS, | 41 net::SpawnedTestServer::TYPE_HTTPS, |
42 net::SpawnedTestServer::kLocalhost, | 42 net::SpawnedTestServer::kLocalhost, |
43 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); | 43 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); |
44 ASSERT_TRUE(https_server_->Start()); | 44 ASSERT_TRUE(https_server_->Start()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 EXPECT_EQ(active_tab, browser()->tab_strip_model()->GetActiveWebContents()); | 141 EXPECT_EQ(active_tab, browser()->tab_strip_model()->GetActiveWebContents()); |
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 #if defined (OS_MACOSX) |
| 152 // crbug.com/375197 |
| 153 #define MAYBE_NotTrustedAfterRedirect DISABLED_NotTrustedAfterRedirect |
| 154 #else |
| 155 #define MAYBE_NotTrustedAfterRedirect NotTrustedAfterRedirect |
| 156 #endif |
| 157 |
| 158 IN_PROC_BROWSER_TEST_F(SigninBrowserTest, MAYBE_NotTrustedAfterRedirect) { |
152 ChromeSigninClient* signin = | 159 ChromeSigninClient* signin = |
153 ChromeSigninClientFactory::GetForProfile(browser()->profile()); | 160 ChromeSigninClientFactory::GetForProfile(browser()->profile()); |
154 EXPECT_FALSE(signin->HasSigninProcess()); | 161 EXPECT_FALSE(signin->HasSigninProcess()); |
155 | 162 |
156 GURL url = signin::GetPromoURL(signin::SOURCE_NTP_LINK, true); | 163 GURL url = signin::GetPromoURL(signin::SOURCE_NTP_LINK, true); |
157 ui_test_utils::NavigateToURL(browser(), url); | 164 ui_test_utils::NavigateToURL(browser(), url); |
158 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); | 165 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); |
159 | 166 |
160 // Navigating in a different tab should not affect the sign-in process. | 167 // Navigating in a different tab should not affect the sign-in process. |
161 ui_test_utils::NavigateToURLWithDisposition( | 168 ui_test_utils::NavigateToURLWithDisposition( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); | 244 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); |
238 EXPECT_EQ(start_url, web_contents->GetVisibleURL()); | 245 EXPECT_EQ(start_url, web_contents->GetVisibleURL()); |
239 | 246 |
240 content::WindowedNotificationObserver observer( | 247 content::WindowedNotificationObserver observer( |
241 content::NOTIFICATION_LOAD_STOP, | 248 content::NOTIFICATION_LOAD_STOP, |
242 content::NotificationService::AllSources()); | 249 content::NotificationService::AllSources()); |
243 observer.Wait(); | 250 observer.Wait(); |
244 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); | 251 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
245 } | 252 } |
246 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 253 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
OLD | NEW |