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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 command_line->AppendSwitchASCII( | 49 command_line->AppendSwitchASCII( |
50 switches::kHostResolverRules, | 50 switches::kHostResolverRules, |
51 "MAP * " + https_server_->host_port_pair().ToString() + | 51 "MAP * " + https_server_->host_port_pair().ToString() + |
52 ",EXCLUDE localhost"); | 52 ",EXCLUDE localhost"); |
53 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); | 53 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
54 // All tests in this file are for the web based sign in flows. | 54 // All tests in this file are for the web based sign in flows. |
55 // TODO(guohui): fix tests for inline sign in flows. | 55 // TODO(guohui): fix tests for inline sign in flows. |
56 command_line->AppendSwitch(switches::kEnableWebBasedSignin); | 56 command_line->AppendSwitch(switches::kEnableWebBasedSignin); |
57 } | 57 } |
58 | 58 |
59 virtual void SetUp() override { | 59 void SetUp() override { |
60 factory_.reset(new net::URLFetcherImplFactory()); | 60 factory_.reset(new net::URLFetcherImplFactory()); |
61 fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get())); | 61 fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get())); |
62 fake_factory_->SetFakeResponse( | 62 fake_factory_->SetFakeResponse( |
63 GaiaUrls::GetInstance()->service_login_url(), std::string(), | 63 GaiaUrls::GetInstance()->service_login_url(), std::string(), |
64 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 64 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
65 fake_factory_->SetFakeResponse( | 65 fake_factory_->SetFakeResponse( |
66 GURL(kNonSigninURL), std::string(), net::HTTP_OK, | 66 GURL(kNonSigninURL), std::string(), net::HTTP_OK, |
67 net::URLRequestStatus::SUCCESS); | 67 net::URLRequestStatus::SUCCESS); |
68 // Yield control back to the InProcessBrowserTest framework. | 68 // Yield control back to the InProcessBrowserTest framework. |
69 InProcessBrowserTest::SetUp(); | 69 InProcessBrowserTest::SetUp(); |
70 } | 70 } |
71 | 71 |
72 virtual void TearDown() override { | 72 void TearDown() override { |
73 if (fake_factory_.get()) { | 73 if (fake_factory_.get()) { |
74 fake_factory_->ClearFakeResponses(); | 74 fake_factory_->ClearFakeResponses(); |
75 fake_factory_.reset(); | 75 fake_factory_.reset(); |
76 } | 76 } |
77 | 77 |
78 // Cancel any outstanding URL fetches and destroy the URLFetcherImplFactory | 78 // Cancel any outstanding URL fetches and destroy the URLFetcherImplFactory |
79 // we created. | 79 // we created. |
80 net::URLFetcher::CancelAll(); | 80 net::URLFetcher::CancelAll(); |
81 factory_.reset(); | 81 factory_.reset(); |
82 InProcessBrowserTest::TearDown(); | 82 InProcessBrowserTest::TearDown(); |
(...skipping 158 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 |