Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc

Issue 1984863002: Clean up LoginUIService. Remove Singleton behavior from PeopleHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync and add datatype push update notifications Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 // Mock the TestChromeWebUIControllerFactory::WebUIProvider to prove that we are 113 // Mock the TestChromeWebUIControllerFactory::WebUIProvider to prove that we are
114 // not called as expected. 114 // not called as expected.
115 class FooWebUIProvider 115 class FooWebUIProvider
116 : public TestChromeWebUIControllerFactory::WebUIProvider { 116 : public TestChromeWebUIControllerFactory::WebUIProvider {
117 public: 117 public:
118 MOCK_METHOD2(NewWebUI, content::WebUIController*(content::WebUI* web_ui, 118 MOCK_METHOD2(NewWebUI, content::WebUIController*(content::WebUI* web_ui,
119 const GURL& url)); 119 const GURL& url));
120 }; 120 };
121 121
122 class MockLoginUIObserver : public LoginUIService::Observer {
123 public:
124 MOCK_METHOD0(OnUntrustedLoginUIShown, void());
125 };
126
127 const char kFooWebUIURL[] = "chrome://foo/"; 122 const char kFooWebUIURL[] = "chrome://foo/";
128 123
129 bool AddToSet(std::set<content::WebContents*>* set, 124 bool AddToSet(std::set<content::WebContents*>* set,
130 content::WebContents* web_contents) { 125 content::WebContents* web_contents) {
131 set->insert(web_contents); 126 set->insert(web_contents);
132 return false; 127 return false;
133 } 128 }
134 129
135 // This class is used to mock out virtual methods with side effects so that 130 // This class is used to mock out virtual methods with side effects so that
136 // tests below can ensure they are called without causing side effects. 131 // tests below can ensure they are called without causing side effects.
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 content::WebContents* contents = 844 content::WebContents* contents =
850 browser()->tab_strip_model()->GetActiveWebContents(); 845 browser()->tab_strip_model()->GetActiveWebContents();
851 ASSERT_TRUE(content::ExecuteScript( 846 ASSERT_TRUE(content::ExecuteScript(
852 contents, "window.location.href = 'chrome://foo'")); 847 contents, "window.location.href = 'chrome://foo'"));
853 848
854 content::TestNavigationObserver navigation_observer(contents, 1); 849 content::TestNavigationObserver navigation_observer(contents, 1);
855 navigation_observer.Wait(); 850 navigation_observer.Wait();
856 851
857 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); 852 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL());
858 } 853 }
859
860 // Flaky on win_chromium_x64_rel_ng: http://crbug605357
861 #if !defined(OS_WIN)
862 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest,
863 ConfirmationRequiredForNonsecureSignin) {
864 FakeGaia fake_gaia;
865 fake_gaia.Initialize();
866
867 embedded_test_server()->RegisterRequestHandler(
868 base::Bind(&FakeGaia::HandleRequest,
869 base::Unretained(&fake_gaia)));
870 fake_gaia.SetFakeMergeSessionParams(
871 "email@gmail.com", "fake-sid-cookie", "fake-lsid-cookie");
872
873 // Navigates to the Chrome signin page which loads the fake gaia auth page.
874 // Since the fake gaia auth page is served over HTTP, thus expects to see an
875 // untrusted signin confirmation dialog upon submitting credentials below.
876 ui_test_utils::NavigateToURL(browser(), GetSigninPromoURL());
877 WaitUntilUIReady(browser());
878
879 MockLoginUIObserver observer;
880 LoginUIServiceFactory::GetForProfile(browser()->profile())
881 ->AddObserver(&observer);
882 base::RunLoop run_loop;
883 EXPECT_CALL(observer, OnUntrustedLoginUIShown())
884 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
885
886 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password");
887 run_loop.Run();
888 base::MessageLoop::current()->RunUntilIdle();
889 }
890 #endif // OS_WIN
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698