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

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: fix merge issue Created 4 years, 6 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/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 // Mock the TestChromeWebUIControllerFactory::WebUIProvider to prove that we are 116 // Mock the TestChromeWebUIControllerFactory::WebUIProvider to prove that we are
117 // not called as expected. 117 // not called as expected.
118 class FooWebUIProvider 118 class FooWebUIProvider
119 : public TestChromeWebUIControllerFactory::WebUIProvider { 119 : public TestChromeWebUIControllerFactory::WebUIProvider {
120 public: 120 public:
121 MOCK_METHOD2(NewWebUI, content::WebUIController*(content::WebUI* web_ui, 121 MOCK_METHOD2(NewWebUI, content::WebUIController*(content::WebUI* web_ui,
122 const GURL& url)); 122 const GURL& url));
123 }; 123 };
124 124
125 class MockLoginUIObserver : public LoginUIService::Observer {
126 public:
127 MOCK_METHOD0(OnUntrustedLoginUIShown, void());
128 };
129
130 const char kFooWebUIURL[] = "chrome://foo/"; 125 const char kFooWebUIURL[] = "chrome://foo/";
131 126
132 bool AddToSet(std::set<content::WebContents*>* set, 127 bool AddToSet(std::set<content::WebContents*>* set,
133 content::WebContents* web_contents) { 128 content::WebContents* web_contents) {
134 set->insert(web_contents); 129 set->insert(web_contents);
135 return false; 130 return false;
136 } 131 }
137 132
138 // This class is used to mock out virtual methods with side effects so that 133 // This class is used to mock out virtual methods with side effects so that
139 // tests below can ensure they are called without causing side effects. 134 // tests below can ensure they are called without causing side effects.
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 content::WebContents* contents = 848 content::WebContents* contents =
854 browser()->tab_strip_model()->GetActiveWebContents(); 849 browser()->tab_strip_model()->GetActiveWebContents();
855 ASSERT_TRUE(content::ExecuteScript( 850 ASSERT_TRUE(content::ExecuteScript(
856 contents, "window.location.href = 'chrome://foo'")); 851 contents, "window.location.href = 'chrome://foo'"));
857 852
858 content::TestNavigationObserver navigation_observer(contents, 1); 853 content::TestNavigationObserver navigation_observer(contents, 1);
859 navigation_observer.Wait(); 854 navigation_observer.Wait();
860 855
861 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); 856 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL());
862 } 857 }
863
864 // Flaky on win_chromium_x64_rel_ng: http://crbug605357
865 #if !defined(OS_WIN)
866 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest,
867 ConfirmationRequiredForNonsecureSignin) {
868 FakeGaia fake_gaia;
869 fake_gaia.Initialize();
870
871 embedded_test_server()->RegisterRequestHandler(
872 base::Bind(&FakeGaia::HandleRequest,
873 base::Unretained(&fake_gaia)));
874 fake_gaia.SetFakeMergeSessionParams(
875 "email@gmail.com", "fake-sid-cookie", "fake-lsid-cookie");
876
877 // Navigates to the Chrome signin page which loads the fake gaia auth page.
878 // Since the fake gaia auth page is served over HTTP, thus expects to see an
879 // untrusted signin confirmation dialog upon submitting credentials below.
880 ui_test_utils::NavigateToURL(browser(), GetSigninPromoURL());
881 WaitUntilUIReady(browser());
882
883 MockLoginUIObserver observer;
884 LoginUIServiceFactory::GetForProfile(browser()->profile())
885 ->AddObserver(&observer);
886 base::RunLoop run_loop;
887 EXPECT_CALL(observer, OnUntrustedLoginUIShown())
888 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
889
890 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password");
891 run_loop.Run();
892 base::RunLoop().RunUntilIdle();
893 }
894 #endif // OS_WIN
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/people_handler.cc ('k') | chrome/browser/ui/webui/signin/login_ui_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698