Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / chromeos / login / simple_web_view_dialog_browsertest.cc
blobe0a40d880e8902c18608587b4b81666e7d9dfe64
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.
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"
19 namespace chromeos {
21 namespace {
23 class StubDelegate : public CaptivePortalWindowProxyDelegate {
24 public:
25 StubDelegate() {}
26 virtual ~StubDelegate() {}
27 virtual void OnPortalDetected() OVERRIDE {}
29 private:
30 DISALLOW_COPY_AND_ASSIGN(StubDelegate);
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();
41 virtual ~InterstitialPageDelegate() {}
43 private:
44 // InterstitialPageDelegate implementation:
45 virtual std::string GetHTMLContents() OVERRIDE { return "HTML Contents"; }
47 DISALLOW_COPY_AND_ASSIGN(InterstitialPageDelegate);
50 } // namespace
52 class SimpleWebViewDialogTest : public LoginManagerTest {
53 public:
54 SimpleWebViewDialogTest(): LoginManagerTest(false) {}
55 virtual ~SimpleWebViewDialogTest() {}
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());
63 private:
64 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialogTest);
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();
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);
80 } // namespace chromeos