OLD | NEW |
(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/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/devtools/devtools_window.h" |
| 8 #include "chrome/browser/devtools/devtools_window_testing.h" |
| 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/test/base/in_process_browser_test.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" |
| 13 #include "content/public/browser/devtools_manager.h" |
| 14 #include "content/public/browser/web_contents.h" |
| 15 |
| 16 class InterstitialUITest : public InProcessBrowserTest { |
| 17 public: |
| 18 InterstitialUITest() {} |
| 19 virtual ~InterstitialUITest() {} |
| 20 |
| 21 protected: |
| 22 void TestInterstitial(GURL url, const std::string& page_title) { |
| 23 ui_test_utils::NavigateToURL(browser(), url); |
| 24 EXPECT_EQ( |
| 25 base::ASCIIToUTF16(page_title), |
| 26 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); |
| 27 |
| 28 // Should also be able to open and close devtools. |
| 29 DevToolsWindow* window = |
| 30 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); |
| 31 EXPECT_TRUE(window); |
| 32 DevToolsWindowTesting::CloseDevToolsWindowSync(window); |
| 33 } |
| 34 }; |
| 35 |
| 36 IN_PROC_BROWSER_TEST_F(InterstitialUITest, OpenInterstitial) { |
| 37 TestInterstitial( |
| 38 GURL("chrome://interstitials"), |
| 39 "Interstitials"); |
| 40 // Invalid path should open the main page: |
| 41 TestInterstitial( |
| 42 GURL("chrome://interstitials/--invalid--"), |
| 43 "Interstitials"); |
| 44 TestInterstitial( |
| 45 GURL("chrome://interstitials/ssl"), |
| 46 "Privacy error"); |
| 47 TestInterstitial( |
| 48 GURL("chrome://interstitials/safebrowsing?type=malware"), |
| 49 "Security error"); |
| 50 TestInterstitial( |
| 51 GURL("chrome://interstitials/safebrowsing?type=phishing"), |
| 52 "Security error"); |
| 53 TestInterstitial( |
| 54 GURL("chrome://interstitials/safebrowsing?type=clientside_malware"), |
| 55 "Security error"); |
| 56 TestInterstitial( |
| 57 GURL("chrome://interstitials/safebrowsing?type=clientside_phishing"), |
| 58 "Security error"); |
| 59 } |
OLD | NEW |