OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" | |
6 | |
7 #include "chrome/browser/ui/browser_commands.h" | |
8 #include "chrome/browser/ui/views/frame/browser_view.h" | |
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | |
10 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | |
11 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | |
12 #include "chrome/test/base/in_process_browser_test.h" | |
13 #include "chrome/test/base/interactive_test_utils.h" | |
14 | |
15 namespace { | |
16 | |
17 typedef InProcessBrowserTest WebSiteSettingsPopupViewBrowserTest; | |
18 | |
19 // Clicks the location icon to open the page info bubble. | |
20 void ClickAndWait(Browser* browser) { | |
21 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | |
22 views::View* location_icon_view = | |
23 browser_view->toolbar()->location_bar()->location_icon_view(); | |
24 ASSERT_TRUE(location_icon_view); | |
25 | |
26 scoped_refptr<content::MessageLoopRunner> runner = | |
27 new content::MessageLoopRunner; | |
28 ui_test_utils::MoveMouseToCenterAndPress( | |
29 location_icon_view, ui_controls::LEFT, | |
30 ui_controls::DOWN | ui_controls::UP, runner->QuitClosure()); | |
31 runner->Run(); | |
32 } | |
33 | |
34 IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ShowPopup) { | |
35 ClickAndWait(browser()); | |
36 EXPECT_EQ(WebsiteSettingsPopupView::POPUP_WEBSITE_SETTINGS, | |
37 WebsiteSettingsPopupView::GetShownPopupType()); | |
38 } | |
39 | |
40 IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ChromeURL) { | |
41 ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings")); | |
42 ClickAndWait(browser()); | |
43 EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE, | |
44 WebsiteSettingsPopupView::GetShownPopupType()); | |
45 } | |
46 | |
47 IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, | |
48 ChromeExtensionURL) { | |
49 ui_test_utils::NavigateToURL( | |
50 browser(), GURL("chrome-extension://extension-id/options.html")); | |
51 ClickAndWait(browser()); | |
52 EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE, | |
53 WebsiteSettingsPopupView::GetShownPopupType()); | |
54 } | |
55 | |
56 IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ChromeDevtoolsURL) { | |
57 ui_test_utils::NavigateToURL( | |
58 browser(), GURL("chrome-devtools://devtools/bundled/inspector.html")); | |
59 ClickAndWait(browser()); | |
60 EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE, | |
61 WebsiteSettingsPopupView::GetShownPopupType()); | |
62 } | |
63 | |
64 IN_PROC_BROWSER_TEST_F(WebSiteSettingsPopupViewBrowserTest, ViewSourceURL) { | |
65 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | |
66 chrome::ViewSelectedSource(browser()); | |
67 ClickAndWait(browser()); | |
68 EXPECT_EQ(WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE, | |
69 WebsiteSettingsPopupView::GetShownPopupType()); | |
70 } | |
71 | |
72 } // namespace | |
OLD | NEW |