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 "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 9 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 consumer->OnClientOAuthSuccess(result); | 501 consumer->OnClientOAuthSuccess(result); |
502 } | 502 } |
503 | 503 |
504 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } | 504 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } |
505 FakeProfileOAuth2TokenService* token_service() { return token_service_; } | 505 FakeProfileOAuth2TokenService* token_service() { return token_service_; } |
506 | 506 |
507 private: | 507 private: |
508 net::TestURLFetcherFactory url_fetcher_factory_; | 508 net::TestURLFetcherFactory url_fetcher_factory_; |
509 FakeSigninManagerForTesting* signin_manager_; | 509 FakeSigninManagerForTesting* signin_manager_; |
510 FakeProfileOAuth2TokenService* token_service_; | 510 FakeProfileOAuth2TokenService* token_service_; |
511 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> | 511 std::unique_ptr< |
| 512 base::CallbackList<void(content::BrowserContext*)>::Subscription> |
512 will_create_browser_context_services_subscription_; | 513 will_create_browser_context_services_subscription_; |
513 | 514 |
514 DISALLOW_COPY_AND_ASSIGN(InlineLoginHelperBrowserTest); | 515 DISALLOW_COPY_AND_ASSIGN(InlineLoginHelperBrowserTest); |
515 }; | 516 }; |
516 | 517 |
517 // Test signin helper calls correct fetcher methods when called with a | 518 // Test signin helper calls correct fetcher methods when called with a |
518 // session index. | 519 // session index. |
519 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, WithSessionIndex) { | 520 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, WithSessionIndex) { |
520 base::WeakPtr<InlineLoginHandlerImpl> handler; | 521 base::WeakPtr<InlineLoginHandlerImpl> handler; |
521 MockInlineSigninHelper helper(handler, | 522 MockInlineSigninHelper helper(handler, |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 791 |
791 void TearDownOnMainThread() override { | 792 void TearDownOnMainThread() override { |
792 test_factory_->RemoveFactoryOverride(GURL(kFooWebUIURL).host()); | 793 test_factory_->RemoveFactoryOverride(GURL(kFooWebUIURL).host()); |
793 content::WebUIControllerFactory::UnregisterFactoryForTesting( | 794 content::WebUIControllerFactory::UnregisterFactoryForTesting( |
794 test_factory_.get()); | 795 test_factory_.get()); |
795 test_factory_.reset(); | 796 test_factory_.reset(); |
796 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 797 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
797 } | 798 } |
798 | 799 |
799 FooWebUIProvider foo_provider_; | 800 FooWebUIProvider foo_provider_; |
800 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; | 801 std::unique_ptr<TestChromeWebUIControllerFactory> test_factory_; |
801 }; | 802 }; |
802 | 803 |
803 // Make sure that the foo webui handler is working properly and that it gets | 804 // Make sure that the foo webui handler is working properly and that it gets |
804 // created when navigated to normally. | 805 // created when navigated to normally. |
805 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, Basic) { | 806 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, Basic) { |
806 const GURL kUrl(kFooWebUIURL); | 807 const GURL kUrl(kFooWebUIURL); |
807 EXPECT_CALL(foo_provider(), NewWebUI(_, ::testing::Eq(kUrl))) | 808 EXPECT_CALL(foo_provider(), NewWebUI(_, ::testing::Eq(kUrl))) |
808 .WillOnce(ReturnNewWebUI()); | 809 .WillOnce(ReturnNewWebUI()); |
809 ui_test_utils::NavigateToURL(browser(), GURL(kFooWebUIURL)); | 810 ui_test_utils::NavigateToURL(browser(), GURL(kFooWebUIURL)); |
810 } | 811 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 LoginUIServiceFactory::GetForProfile(browser()->profile()) | 878 LoginUIServiceFactory::GetForProfile(browser()->profile()) |
878 ->AddObserver(&observer); | 879 ->AddObserver(&observer); |
879 base::RunLoop run_loop; | 880 base::RunLoop run_loop; |
880 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) | 881 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) |
881 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 882 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
882 | 883 |
883 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); | 884 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); |
884 run_loop.Run(); | 885 run_loop.Run(); |
885 base::MessageLoop::current()->RunUntilIdle(); | 886 base::MessageLoop::current()->RunUntilIdle(); |
886 } | 887 } |
OLD | NEW |