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

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

Issue 1402363013: Update location bar bubble/icon behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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
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 "chrome/browser/ui/browser_commands.h" 7 #include "chrome/browser/ui/browser_commands.h"
8 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 8 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" 9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
10 #include "chrome/browser/ui/views/frame/browser_view.h" 10 #include "chrome/browser/ui/views/frame/browser_view.h"
11 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 11 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 13
14 typedef InProcessBrowserTest ZoomBubbleBrowserTest; 14 typedef InProcessBrowserTest ZoomBubbleBrowserTest;
15 15
16 // TODO(linux_aura) http://crbug.com/163931 16 // TODO(linux_aura) http://crbug.com/163931
17 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 17 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
18 #define MAYBE_NonImmersiveFullscreen DISABLED_NonImmersiveFullscreen 18 #define MAYBE_NonImmersiveFullscreen DISABLED_NonImmersiveFullscreen
19 #else 19 #else
20 #define MAYBE_NonImmersiveFullscreen NonImmersiveFullscreen 20 #define MAYBE_NonImmersiveFullscreen NonImmersiveFullscreen
21 #endif 21 #endif
22 // Test whether the zoom bubble is anchored and whether it is visible when in 22 // Test whether the zoom bubble is anchored and whether it is visible when in
23 // non-immersive fullscreen. 23 // non-immersive fullscreen.
24 IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, MAYBE_NonImmersiveFullscreen) { 24 IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, MAYBE_NonImmersiveFullscreen) {
25 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); 25 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
26 content::WebContents* web_contents = browser_view->GetActiveWebContents(); 26 content::WebContents* web_contents = browser_view->GetActiveWebContents();
27 27
28 // The zoom bubble should be anchored when not in fullscreen. 28 // The zoom bubble should be anchored when not in fullscreen.
29 ZoomBubbleView::ShowBubble(web_contents, true); 29 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
30 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 30 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
31 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble(); 31 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble();
32 EXPECT_TRUE(zoom_bubble->GetAnchorView()); 32 EXPECT_TRUE(zoom_bubble->GetAnchorView());
33 33
34 // Entering fullscreen should close the bubble. (We enter into tab fullscreen 34 // Entering fullscreen should close the bubble. (We enter into tab fullscreen
35 // here because tab fullscreen is non-immersive even on Chrome OS.) 35 // here because tab fullscreen is non-immersive even on Chrome OS.)
36 { 36 {
37 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. Wait for the 37 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. Wait for the
38 // notification before testing the zoom bubble visibility. 38 // notification before testing the zoom bubble visibility.
39 scoped_ptr<FullscreenNotificationObserver> waiter( 39 scoped_ptr<FullscreenNotificationObserver> waiter(
40 new FullscreenNotificationObserver()); 40 new FullscreenNotificationObserver());
41 browser() 41 browser()
42 ->exclusive_access_manager() 42 ->exclusive_access_manager()
43 ->fullscreen_controller() 43 ->fullscreen_controller()
44 ->EnterFullscreenModeForTab(web_contents, GURL()); 44 ->EnterFullscreenModeForTab(web_contents, GURL());
45 waiter->Wait(); 45 waiter->Wait();
46 } 46 }
47 ASSERT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); 47 ASSERT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
48 EXPECT_FALSE(ZoomBubbleView::GetZoomBubble()); 48 EXPECT_FALSE(ZoomBubbleView::GetZoomBubble());
49 49
50 // The bubble should not be anchored when it is shown in non-immersive 50 // The bubble should not be anchored when it is shown in non-immersive
51 // fullscreen. 51 // fullscreen.
52 ZoomBubbleView::ShowBubble(web_contents, true); 52 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
53 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 53 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
54 zoom_bubble = ZoomBubbleView::GetZoomBubble(); 54 zoom_bubble = ZoomBubbleView::GetZoomBubble();
55 EXPECT_FALSE(zoom_bubble->GetAnchorView()); 55 EXPECT_FALSE(zoom_bubble->GetAnchorView());
56 56
57 // Exit fullscreen before ending the test for the sake of sanity. 57 // Exit fullscreen before ending the test for the sake of sanity.
58 { 58 {
59 scoped_ptr<FullscreenNotificationObserver> waiter( 59 scoped_ptr<FullscreenNotificationObserver> waiter(
60 new FullscreenNotificationObserver()); 60 new FullscreenNotificationObserver());
61 chrome::ToggleFullscreenMode(browser()); 61 chrome::ToggleFullscreenMode(browser());
62 waiter->Wait(); 62 waiter->Wait();
(...skipping 17 matching lines...) Expand all
80 scoped_ptr<FullscreenNotificationObserver> waiter( 80 scoped_ptr<FullscreenNotificationObserver> waiter(
81 new FullscreenNotificationObserver()); 81 new FullscreenNotificationObserver());
82 chrome::ToggleFullscreenMode(browser()); 82 chrome::ToggleFullscreenMode(browser());
83 waiter->Wait(); 83 waiter->Wait();
84 } 84 }
85 ASSERT_TRUE(immersive_controller->IsEnabled()); 85 ASSERT_TRUE(immersive_controller->IsEnabled());
86 ASSERT_FALSE(immersive_controller->IsRevealed()); 86 ASSERT_FALSE(immersive_controller->IsRevealed());
87 87
88 // The zoom bubble should not be anchored when it is shown in immersive 88 // The zoom bubble should not be anchored when it is shown in immersive
89 // fullscreen and the top-of-window views are not revealed. 89 // fullscreen and the top-of-window views are not revealed.
90 ZoomBubbleView::ShowBubble(web_contents, true); 90 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
91 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 91 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
92 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble(); 92 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble();
93 EXPECT_FALSE(zoom_bubble->GetAnchorView()); 93 EXPECT_FALSE(zoom_bubble->GetAnchorView());
94 94
95 // An immersive reveal should hide the zoom bubble. 95 // An immersive reveal should hide the zoom bubble.
96 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( 96 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock(
97 immersive_controller->GetRevealedLock( 97 immersive_controller->GetRevealedLock(
98 ImmersiveModeController::ANIMATE_REVEAL_NO)); 98 ImmersiveModeController::ANIMATE_REVEAL_NO));
99 ASSERT_TRUE(immersive_controller->IsRevealed()); 99 ASSERT_TRUE(immersive_controller->IsRevealed());
100 EXPECT_EQ(NULL, ZoomBubbleView::zoom_bubble_); 100 EXPECT_EQ(NULL, ZoomBubbleView::zoom_bubble_);
101 101
102 // The zoom bubble should be anchored when it is shown in immersive fullscreen 102 // The zoom bubble should be anchored when it is shown in immersive fullscreen
103 // and the top-of-window views are revealed. 103 // and the top-of-window views are revealed.
104 ZoomBubbleView::ShowBubble(web_contents, true); 104 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
105 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 105 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
106 zoom_bubble = ZoomBubbleView::GetZoomBubble(); 106 zoom_bubble = ZoomBubbleView::GetZoomBubble();
107 EXPECT_TRUE(zoom_bubble->GetAnchorView()); 107 EXPECT_TRUE(zoom_bubble->GetAnchorView());
108 108
109 // The top-of-window views should not hide till the zoom bubble hides. (It 109 // The top-of-window views should not hide till the zoom bubble hides. (It
110 // would be weird if the view to which the zoom bubble is anchored hid while 110 // would be weird if the view to which the zoom bubble is anchored hid while
111 // the zoom bubble was still visible.) 111 // the zoom bubble was still visible.)
112 immersive_reveal_lock.reset(); 112 immersive_reveal_lock.reset();
113 EXPECT_TRUE(immersive_controller->IsRevealed()); 113 EXPECT_TRUE(immersive_controller->IsRevealed());
114 ZoomBubbleView::CloseBubble(); 114 ZoomBubbleView::CloseBubble();
115 // The zoom bubble is deleted on a task. 115 // The zoom bubble is deleted on a task.
116 content::RunAllPendingInMessageLoop(); 116 content::RunAllPendingInMessageLoop();
117 EXPECT_FALSE(immersive_controller->IsRevealed()); 117 EXPECT_FALSE(immersive_controller->IsRevealed());
118 118
119 // Exit fullscreen before ending the test for the sake of sanity. 119 // Exit fullscreen before ending the test for the sake of sanity.
120 { 120 {
121 scoped_ptr<FullscreenNotificationObserver> waiter( 121 scoped_ptr<FullscreenNotificationObserver> waiter(
122 new FullscreenNotificationObserver()); 122 new FullscreenNotificationObserver());
123 chrome::ToggleFullscreenMode(browser()); 123 chrome::ToggleFullscreenMode(browser());
124 waiter->Wait(); 124 waiter->Wait();
125 } 125 }
126 } 126 }
127 #endif // OS_CHROMEOS 127 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/zoom_bubble_view.cc ('k') | chrome/browser/ui/views/location_bar/zoom_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698