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

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

Issue 286933002: [cros login] Split login related classes into subfolders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix includes in new tests 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/compiler_specific.h"
6 #include "base/logging.h"
7 #include "base/macros.h"
8 #include "chrome/browser/chromeos/login/captive_portal_view.h"
9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h"
10 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
11 #include "chrome/browser/chromeos/login/login_manager_test.h"
12 #include "chrome/browser/chromeos/login/simple_web_view_dialog.h"
13 #include "chrome/browser/chromeos/login/webui_login_view.h"
14 #include "chrome/browser/chromeos/profiles/profile_helper.h"
15 #include "content/public/browser/interstitial_page.h"
16 #include "content/public/browser/interstitial_page_delegate.h"
17 #include "ui/views/controls/webview/webview.h"
18
19 namespace chromeos {
20
21 namespace {
22
23 class StubDelegate : public CaptivePortalWindowProxyDelegate {
24 public:
25 StubDelegate() {}
26 virtual ~StubDelegate() {}
27 virtual void OnPortalDetected() OVERRIDE {}
28
29 private:
30 DISALLOW_COPY_AND_ASSIGN(StubDelegate);
31 };
32
33 class InterstitialPageDelegate : public content::InterstitialPageDelegate {
34 public:
35 explicit InterstitialPageDelegate(content::WebContents* web_contents) {
36 content::InterstitialPage* page = content::InterstitialPage::Create(
37 web_contents, true, GURL("http://foo"), this);
38 page->Show();
39 }
40
41 virtual ~InterstitialPageDelegate() {}
42
43 private:
44 // InterstitialPageDelegate implementation:
45 virtual std::string GetHTMLContents() OVERRIDE { return "HTML Contents"; }
46
47 DISALLOW_COPY_AND_ASSIGN(InterstitialPageDelegate);
48 };
49
50 } // namespace
51
52 class SimpleWebViewDialogTest : public LoginManagerTest {
53 public:
54 SimpleWebViewDialogTest(): LoginManagerTest(false) {}
55 virtual ~SimpleWebViewDialogTest() {}
56
57 InterstitialPageDelegate* CreateDelegate(CaptivePortalWindowProxy* proxy) {
58 SimpleWebViewDialog* dialog = proxy->captive_portal_view_for_testing();
59 CHECK(dialog) << "CaptivePortalView is not initialized";
60 return new InterstitialPageDelegate(dialog->web_view_->web_contents());
61 }
62
63 private:
64 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialogTest);
65 };
66
67 IN_PROC_BROWSER_TEST_F(SimpleWebViewDialogTest, Interstitial) {
68 content::WebContents* web_contents = LoginDisplayHostImpl::default_host()
69 ->GetWebUILoginView()
70 ->GetWebContents();
71 StubDelegate delegate;
72 CaptivePortalWindowProxy proxy(&delegate, web_contents);
73 proxy.Show();
74
75 // Delegate creates a page and passes himself to it. Page owns the
76 // delegate and will be destroyed by the end of the test.
77 CreateDelegate(&proxy);
78 }
79
80 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/simple_web_view_dialog.cc ('k') | chrome/browser/chromeos/login/supervised_user_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698