| 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 18 matching lines...) Expand all Loading... |
| 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[] = "http://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 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()); |
| 45 | 45 |
| 46 // Add a host resolver rule to map all outgoing requests to the test server. | 46 // Add a host resolver rule to map all outgoing requests to the test server. |
| 47 // This allows us to use "real" hostnames in URLs, which we can use to | 47 // This allows us to use "real" hostnames in URLs, which we can use to |
| 48 // create arbitrary SiteInstances. | 48 // create arbitrary SiteInstances. |
| 49 command_line->AppendSwitchASCII( | 49 command_line->AppendSwitchASCII( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ui_test_utils::NavigateToURL(browser(), redirect_url); | 176 ui_test_utils::NavigateToURL(browser(), redirect_url); |
| 177 EXPECT_FALSE(signin->HasSigninProcess()); | 177 EXPECT_FALSE(signin->HasSigninProcess()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 class BackOnNTPCommitObserver : public content::WebContentsObserver { | 180 class BackOnNTPCommitObserver : public content::WebContentsObserver { |
| 181 public: | 181 public: |
| 182 explicit BackOnNTPCommitObserver(content::WebContents* web_contents) | 182 explicit BackOnNTPCommitObserver(content::WebContents* web_contents) |
| 183 : content::WebContentsObserver(web_contents) { | 183 : content::WebContentsObserver(web_contents) { |
| 184 } | 184 } |
| 185 | 185 |
| 186 virtual void DidCommitProvisionalLoadForFrame( | 186 void DidCommitProvisionalLoadForFrame( |
| 187 content::RenderFrameHost* render_frame_host, | 187 content::RenderFrameHost* render_frame_host, |
| 188 const GURL& url, | 188 const GURL& url, |
| 189 ui::PageTransition transition_type) override { | 189 ui::PageTransition transition_type) override { |
| 190 if (url == GURL(chrome::kChromeUINewTabURL) || | 190 if (url == GURL(chrome::kChromeUINewTabURL) || |
| 191 url == GURL(chrome::kChromeSearchLocalNtpUrl)) { | 191 url == GURL(chrome::kChromeSearchLocalNtpUrl)) { |
| 192 content::WindowedNotificationObserver observer( | 192 content::WindowedNotificationObserver observer( |
| 193 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 193 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 194 content::NotificationService::AllSources()); | 194 content::NotificationService::AllSources()); |
| 195 web_contents()->GetController().GoBack(); | 195 web_contents()->GetController().GoBack(); |
| 196 observer.Wait(); | 196 observer.Wait(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); | 241 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); |
| 242 EXPECT_EQ(start_url, web_contents->GetVisibleURL()); | 242 EXPECT_EQ(start_url, web_contents->GetVisibleURL()); |
| 243 | 243 |
| 244 content::WindowedNotificationObserver observer( | 244 content::WindowedNotificationObserver observer( |
| 245 content::NOTIFICATION_LOAD_STOP, | 245 content::NOTIFICATION_LOAD_STOP, |
| 246 content::NotificationService::AllSources()); | 246 content::NotificationService::AllSources()); |
| 247 observer.Wait(); | 247 observer.Wait(); |
| 248 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); | 248 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
| 249 } | 249 } |
| 250 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 250 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
| OLD | NEW |