| 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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/signin/signin_promo.h" | 6 #include "chrome/browser/signin/signin_promo.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 9 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" |
| 10 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 10 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 // Executes JavaScript code in the auth iframe hosted by gaia_auth extension. | 167 // Executes JavaScript code in the auth iframe hosted by gaia_auth extension. |
| 168 void ExecuteJsInSigninFrame(const std::string& js) { | 168 void ExecuteJsInSigninFrame(const std::string& js) { |
| 169 content::WebContents* web_contents = | 169 content::WebContents* web_contents = |
| 170 browser()->tab_strip_model()->GetActiveWebContents(); | 170 browser()->tab_strip_model()->GetActiveWebContents(); |
| 171 ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthIframe( | 171 ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthIframe( |
| 172 web_contents, GURL(), "signin-frame"), js)); | 172 web_contents, GURL(), "signin-frame"), js)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 virtual void SetUp() OVERRIDE { | 176 virtual void SetUp() override { |
| 177 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 177 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 178 | 178 |
| 179 // EmbeddedTestServer spawns a thread to initialize socket. | 179 // EmbeddedTestServer spawns a thread to initialize socket. |
| 180 // Stop IO thread in preparation for fork and exec. | 180 // Stop IO thread in preparation for fork and exec. |
| 181 embedded_test_server()->StopThread(); | 181 embedded_test_server()->StopThread(); |
| 182 | 182 |
| 183 InProcessBrowserTest::SetUp(); | 183 InProcessBrowserTest::SetUp(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 186 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 187 const GURL& base_url = embedded_test_server()->base_url(); | 187 const GURL& base_url = embedded_test_server()->base_url(); |
| 188 command_line->AppendSwitchASCII(::switches::kGaiaUrl, base_url.spec()); | 188 command_line->AppendSwitchASCII(::switches::kGaiaUrl, base_url.spec()); |
| 189 command_line->AppendSwitchASCII(::switches::kLsoUrl, base_url.spec()); | 189 command_line->AppendSwitchASCII(::switches::kLsoUrl, base_url.spec()); |
| 190 command_line->AppendSwitchASCII(::switches::kGoogleApisUrl, | 190 command_line->AppendSwitchASCII(::switches::kGoogleApisUrl, |
| 191 base_url.spec()); | 191 base_url.spec()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 virtual void SetUpOnMainThread() OVERRIDE { | 194 virtual void SetUpOnMainThread() override { |
| 195 embedded_test_server()->RestartThreadAndListen(); | 195 embedded_test_server()->RestartThreadAndListen(); |
| 196 | 196 |
| 197 content::WebUIControllerFactory::UnregisterFactoryForTesting( | 197 content::WebUIControllerFactory::UnregisterFactoryForTesting( |
| 198 ChromeWebUIControllerFactory::GetInstance()); | 198 ChromeWebUIControllerFactory::GetInstance()); |
| 199 test_factory_.reset(new TestChromeWebUIControllerFactory); | 199 test_factory_.reset(new TestChromeWebUIControllerFactory); |
| 200 content::WebUIControllerFactory::RegisterFactory(test_factory_.get()); | 200 content::WebUIControllerFactory::RegisterFactory(test_factory_.get()); |
| 201 test_factory_->AddFactoryOverride( | 201 test_factory_->AddFactoryOverride( |
| 202 GURL(kFooWebUIURL).host(), &foo_provider_); | 202 GURL(kFooWebUIURL).host(), &foo_provider_); |
| 203 } | 203 } |
| 204 | 204 |
| 205 virtual void TearDownOnMainThread() OVERRIDE { | 205 virtual void TearDownOnMainThread() override { |
| 206 test_factory_->RemoveFactoryOverride(GURL(kFooWebUIURL).host()); | 206 test_factory_->RemoveFactoryOverride(GURL(kFooWebUIURL).host()); |
| 207 content::WebUIControllerFactory::UnregisterFactoryForTesting( | 207 content::WebUIControllerFactory::UnregisterFactoryForTesting( |
| 208 test_factory_.get()); | 208 test_factory_.get()); |
| 209 test_factory_.reset(); | 209 test_factory_.reset(); |
| 210 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 210 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
| 211 } | 211 } |
| 212 | 212 |
| 213 FooWebUIProvider foo_provider_; | 213 FooWebUIProvider foo_provider_; |
| 214 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; | 214 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; |
| 215 }; | 215 }; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 std::string js = | 314 std::string js = |
| 315 "document.getElementById('Email').value = 'email';" | 315 "document.getElementById('Email').value = 'email';" |
| 316 "document.getElementById('Passwd').value = 'password';" | 316 "document.getElementById('Passwd').value = 'password';" |
| 317 "document.getElementById('signIn').click();"; | 317 "document.getElementById('signIn').click();"; |
| 318 ExecuteJsInSigninFrame(js); | 318 ExecuteJsInSigninFrame(js); |
| 319 | 319 |
| 320 run_loop.Run(); | 320 run_loop.Run(); |
| 321 base::MessageLoop::current()->RunUntilIdle(); | 321 base::MessageLoop::current()->RunUntilIdle(); |
| 322 } | 322 } |
| 323 #endif // OS_CHROMEOS | 323 #endif // OS_CHROMEOS |
| OLD | NEW |