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/signin_manager.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_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/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
22 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
25 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
26 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
(...skipping 16 matching lines...) Expand all Loading... |
43 ASSERT_TRUE(https_server_->Start()); | 44 ASSERT_TRUE(https_server_->Start()); |
44 | 45 |
45 // 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. |
46 // 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 |
47 // create arbitrary SiteInstances. | 48 // create arbitrary SiteInstances. |
48 command_line->AppendSwitchASCII( | 49 command_line->AppendSwitchASCII( |
49 switches::kHostResolverRules, | 50 switches::kHostResolverRules, |
50 "MAP * " + https_server_->host_port_pair().ToString() + | 51 "MAP * " + https_server_->host_port_pair().ToString() + |
51 ",EXCLUDE localhost"); | 52 ",EXCLUDE localhost"); |
52 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. |
| 55 // TODO(guohui): adds new tests for inline sign in flows. |
| 56 command_line->AppendSwitch(switches::kEnableWebBasedSignin); |
53 } | 57 } |
54 | 58 |
55 virtual void SetUp() OVERRIDE { | 59 virtual void SetUp() OVERRIDE { |
56 factory_.reset(new net::URLFetcherImplFactory()); | 60 factory_.reset(new net::URLFetcherImplFactory()); |
57 fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get())); | 61 fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get())); |
58 fake_factory_->SetFakeResponse( | 62 fake_factory_->SetFakeResponse( |
59 GaiaUrls::GetInstance()->service_login_url(), std::string(), | 63 GaiaUrls::GetInstance()->service_login_url(), std::string(), |
60 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 64 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
61 fake_factory_->SetFakeResponse( | 65 fake_factory_->SetFakeResponse( |
62 GURL(kNonSigninURL), std::string(), net::HTTP_OK, | 66 GURL(kNonSigninURL), std::string(), net::HTTP_OK, |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); | 238 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); |
235 EXPECT_EQ(ntp_url, web_contents->GetVisibleURL()); | 239 EXPECT_EQ(ntp_url, web_contents->GetVisibleURL()); |
236 | 240 |
237 content::WindowedNotificationObserver observer( | 241 content::WindowedNotificationObserver observer( |
238 content::NOTIFICATION_LOAD_STOP, | 242 content::NOTIFICATION_LOAD_STOP, |
239 content::NotificationService::AllSources()); | 243 content::NotificationService::AllSources()); |
240 observer.Wait(); | 244 observer.Wait(); |
241 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); | 245 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); |
242 } | 246 } |
243 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ | 247 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ |
OLD | NEW |