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

Side by Side Diff: chrome/browser/chromeos/login/simple_web_view_dialog_browsertest.cc

Issue 270563002: Componentize LoginManagerTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/chromeos/login/captive_portal_view.h" 8 #include "chrome/browser/chromeos/login/captive_portal_view.h"
9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" 9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h"
10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 10 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
11 #include "chrome/browser/chromeos/login/login_manager_test.h" 11 #include "chrome/browser/chromeos/login/login_manager_test_helper.h"
12 #include "chrome/browser/chromeos/login/simple_web_view_dialog.h" 12 #include "chrome/browser/chromeos/login/simple_web_view_dialog.h"
13 #include "chrome/browser/chromeos/login/webui_login_view.h" 13 #include "chrome/browser/chromeos/login/webui_login_view.h"
14 #include "chrome/browser/chromeos/profiles/profile_helper.h" 14 #include "chrome/browser/chromeos/profiles/profile_helper.h"
15 #include "chrome/test/base/in_process_browser_test.h"
15 #include "content/public/browser/interstitial_page.h" 16 #include "content/public/browser/interstitial_page.h"
16 #include "content/public/browser/interstitial_page_delegate.h" 17 #include "content/public/browser/interstitial_page_delegate.h"
17 #include "ui/views/controls/webview/webview.h" 18 #include "ui/views/controls/webview/webview.h"
18 19
19 namespace chromeos { 20 namespace chromeos {
20 21
21 namespace { 22 namespace {
22 23
23 class StubDelegate : public CaptivePortalWindowProxyDelegate { 24 class StubDelegate : public CaptivePortalWindowProxyDelegate {
24 public: 25 public:
(...skipping 17 matching lines...) Expand all
42 43
43 private: 44 private:
44 // InterstitialPageDelegate implementation: 45 // InterstitialPageDelegate implementation:
45 virtual std::string GetHTMLContents() OVERRIDE { return "HTML Contents"; } 46 virtual std::string GetHTMLContents() OVERRIDE { return "HTML Contents"; }
46 47
47 DISALLOW_COPY_AND_ASSIGN(InterstitialPageDelegate); 48 DISALLOW_COPY_AND_ASSIGN(InterstitialPageDelegate);
48 }; 49 };
49 50
50 } // namespace 51 } // namespace
51 52
52 class SimpleWebViewDialogTest : public LoginManagerTest { 53 class SimpleWebViewDialogTest : public InProcessBrowserTest {
53 public: 54 public:
54 SimpleWebViewDialogTest(): LoginManagerTest(false) {} 55 SimpleWebViewDialogTest()
56 : login_manager_test_helper_(new LoginManagerTestHelper(false)) {
57 set_exit_when_last_browser_closes(false);
58 }
59
55 virtual ~SimpleWebViewDialogTest() {} 60 virtual ~SimpleWebViewDialogTest() {}
56 61
62 virtual void SetUpOnMainThread() OVERRIDE {
63 login_manager_test_helper_->SetUp();
64 }
65
66 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
67 login_manager_test_helper_->SetUpCommandLine(command_line);
68 }
69
70 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
71 login_manager_test_helper_->SetUpLoginUtils();
72 }
73
74 virtual void CleanUpOnMainThread() OVERRIDE {
75 login_manager_test_helper_->CleanUp();
76 }
77
57 InterstitialPageDelegate* CreateDelegate(CaptivePortalWindowProxy* proxy) { 78 InterstitialPageDelegate* CreateDelegate(CaptivePortalWindowProxy* proxy) {
58 SimpleWebViewDialog* dialog = proxy->captive_portal_view_for_testing(); 79 SimpleWebViewDialog* dialog = proxy->captive_portal_view_for_testing();
59 CHECK(dialog) << "CaptivePortalView is not initialized"; 80 CHECK(dialog) << "CaptivePortalView is not initialized";
60 return new InterstitialPageDelegate(dialog->web_view_->web_contents()); 81 return new InterstitialPageDelegate(dialog->web_view_->web_contents());
61 } 82 }
62 83
63 private: 84 private:
85 scoped_ptr<LoginManagerTestHelper> login_manager_test_helper_;
86
64 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialogTest); 87 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialogTest);
65 }; 88 };
66 89
67 IN_PROC_BROWSER_TEST_F(SimpleWebViewDialogTest, Interstitial) { 90 IN_PROC_BROWSER_TEST_F(SimpleWebViewDialogTest, Interstitial) {
68 content::WebContents* web_contents = LoginDisplayHostImpl::default_host() 91 content::WebContents* web_contents = LoginDisplayHostImpl::default_host()
69 ->GetWebUILoginView() 92 ->GetWebUILoginView()
70 ->GetWebContents(); 93 ->GetWebContents();
71 StubDelegate delegate; 94 StubDelegate delegate;
72 CaptivePortalWindowProxy proxy(&delegate, web_contents); 95 CaptivePortalWindowProxy proxy(&delegate, web_contents);
73 proxy.Show(); 96 proxy.Show();
74 97
75 // Delegate creates a page and passes himself to it. Page owns the 98 // Delegate creates a page and passes himself to it. Page owns the
76 // delegate and will be destroyed by the end of the test. 99 // delegate and will be destroyed by the end of the test.
77 CreateDelegate(&proxy); 100 CreateDelegate(&proxy);
78 } 101 }
79 102
80 } // namespace chromeos 103 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698