| Index: chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
|
| diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..11e21712cad0979988a758986d76b35492661284
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
|
| @@ -0,0 +1,57 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/strings/utf_string_conversions.h"
|
| +#include "chrome/browser/chrome_notification_types.h"
|
| +#include "chrome/browser/devtools/devtools_window.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| +#include "chrome/test/base/in_process_browser_test.h"
|
| +#include "chrome/test/base/ui_test_utils.h"
|
| +#include "content/public/browser/devtools_manager.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +
|
| +class InterstitialUITest : public InProcessBrowserTest {
|
| + public:
|
| + InterstitialUITest() {}
|
| + virtual ~InterstitialUITest() {}
|
| +
|
| + protected:
|
| + content::WebContents* GetInspectedTab() {
|
| + return browser()->tab_strip_model()->GetWebContentsAt(0);
|
| + }
|
| +
|
| + void TestInterstitial(GURL url, std::string page_title) {
|
| + ui_test_utils::NavigateToURL(browser(), url);
|
| + EXPECT_EQ(
|
| + base::ASCIIToUTF16(page_title),
|
| + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
|
| +
|
| + // Should also be able to open and close devtools.
|
| + content::RenderViewHost* rvh =
|
| + browser()->tab_strip_model()->GetWebContentsAt(0)->GetRenderViewHost();
|
| + DevToolsWindow* window = DevToolsWindow::OpenDevToolsWindowForTest(rvh,
|
| + true);
|
| + ui_test_utils::WaitUntilDevToolsWindowLoaded(window);
|
| + // Try closing the devtools.
|
| + content::WindowedNotificationObserver close_observer(
|
| + content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| + content::Source<content::WebContents>(
|
| + window->web_contents_for_test()));
|
| + DevToolsWindow::ToggleDevToolsWindow(
|
| + browser(),
|
| + DevToolsToggleAction::Toggle());
|
| + close_observer.Wait();
|
| + }
|
| +};
|
| +
|
| +IN_PROC_BROWSER_TEST_F(InterstitialUITest, OpenInterstitial) {
|
| + TestInterstitial(GURL("chrome://interstitials"), "Interstitials");
|
| + TestInterstitial(GURL("chrome://interstitials/--invalid--"), "Interstitials");
|
| + TestInterstitial(GURL("chrome://interstitials/ssl"), "Privacy error");
|
| + TestInterstitial(GURL("chrome://interstitials/safebrowsing?type=malware"),
|
| + "Security error");
|
| + TestInterstitial(GURL("chrome://interstitials/safebrowsing?type=phishing"),
|
| + "Security error");
|
| +}
|
|
|