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

Side by Side Diff: chrome/browser/ui/views/location_bar/zoom_bubble_view_browsertest.cc

Issue 2963893002: [ui] Adds a browser_tests hook to show ZoomBubbleView (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
6 6
7 #include "base/command_line.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
8 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
12 #include "chrome/browser/ui/test/test_browser_dialog.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 14 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
13 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "ui/base/ui_base_switches.h"
14 17
15 typedef InProcessBrowserTest ZoomBubbleBrowserTest; 18 typedef InProcessBrowserTest ZoomBubbleBrowserTest;
16 19
17 #if defined(USE_ASH) 20 #if defined(USE_ASH)
18 #include "ash/test/immersive_fullscreen_controller_test_api.h" 21 #include "ash/test/immersive_fullscreen_controller_test_api.h"
19 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" 22 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
20 #endif 23 #endif
21 24
22 // TODO(linux_aura) http://crbug.com/163931 25 // TODO(linux_aura) http://crbug.com/163931
23 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 26 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 67
65 // Exit fullscreen before ending the test for the sake of sanity. 68 // Exit fullscreen before ending the test for the sake of sanity.
66 { 69 {
67 std::unique_ptr<FullscreenNotificationObserver> waiter( 70 std::unique_ptr<FullscreenNotificationObserver> waiter(
68 new FullscreenNotificationObserver()); 71 new FullscreenNotificationObserver());
69 chrome::ToggleFullscreenMode(browser()); 72 chrome::ToggleFullscreenMode(browser());
70 waiter->Wait(); 73 waiter->Wait();
71 } 74 }
72 } 75 }
73 76
77 class ZoomBubbleDialogTest : public DialogBrowserTest {
78 public:
79 ZoomBubbleDialogTest() {}
80
81 // DialogBrowserTest:
82 void ShowDialog(const std::string& name) override {
83 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
84 content::WebContents* web_contents = browser_view->GetActiveWebContents();
85 ZoomBubbleView::ShowBubble(web_contents, gfx::Point(),
86 ZoomBubbleView::USER_GESTURE);
87 }
88
89 // content::BrowserTestBase:
90 void SetUpCommandLine(base::CommandLine* command_line) override {
91 command_line->AppendSwitch(switches::kExtendMdToSecondaryUi);
Peter Kasting 2017/06/29 01:07:26 Why this line? Seems like you want to test the di
varkha 2017/06/29 01:14:36 Looked at a couple examples that are doing this so
92 }
93
94 private:
95 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleDialogTest);
96 };
97
98 // Test that calls ShowDialog("default"). Interactive when run via
99 // browser_tests --gtest_filter=BrowserDialogTest.Invoke --interactive
100 // --dialog=ZoomBubbleDialogTest.InvokeDialog_default
101 IN_PROC_BROWSER_TEST_F(ZoomBubbleDialogTest, InvokeDialog_default) {
102 RunDialog();
103 }
104
74 // TODO(zturner): Change this to USE_ASH after fixing the test on Windows. 105 // TODO(zturner): Change this to USE_ASH after fixing the test on Windows.
75 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
76 // Test whether the zoom bubble is anchored and whether it is visible when in 107 // Test whether the zoom bubble is anchored and whether it is visible when in
77 // immersive fullscreen. 108 // immersive fullscreen.
78 IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) { 109 IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) {
79 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); 110 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
80 content::WebContents* web_contents = browser_view->GetActiveWebContents(); 111 content::WebContents* web_contents = browser_view->GetActiveWebContents();
81 112
82 ImmersiveModeController* immersive_controller = 113 ImmersiveModeController* immersive_controller =
83 browser_view->immersive_mode_controller(); 114 browser_view->immersive_mode_controller();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 163
133 // Exit fullscreen before ending the test for the sake of sanity. 164 // Exit fullscreen before ending the test for the sake of sanity.
134 { 165 {
135 std::unique_ptr<FullscreenNotificationObserver> waiter( 166 std::unique_ptr<FullscreenNotificationObserver> waiter(
136 new FullscreenNotificationObserver()); 167 new FullscreenNotificationObserver());
137 chrome::ToggleFullscreenMode(browser()); 168 chrome::ToggleFullscreenMode(browser());
138 waiter->Wait(); 169 waiter->Wait();
139 } 170 }
140 } 171 }
141 #endif // OS_CHROMEOS 172 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698