OLD | NEW |
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/fullscreen/fullscreen_controller.h" | 8 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
9 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" | 9 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ZoomBubbleView::ShowBubble(web_contents, true); | 89 ZoomBubbleView::ShowBubble(web_contents, true); |
90 ASSERT_TRUE(ZoomBubbleView::IsShowing()); | 90 ASSERT_TRUE(ZoomBubbleView::IsShowing()); |
91 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest(); | 91 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest(); |
92 EXPECT_FALSE(zoom_bubble->GetAnchorView()); | 92 EXPECT_FALSE(zoom_bubble->GetAnchorView()); |
93 | 93 |
94 // An immersive reveal should hide the zoom bubble. | 94 // An immersive reveal should hide the zoom bubble. |
95 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( | 95 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( |
96 immersive_controller->GetRevealedLock( | 96 immersive_controller->GetRevealedLock( |
97 ImmersiveModeController::ANIMATE_REVEAL_NO)); | 97 ImmersiveModeController::ANIMATE_REVEAL_NO)); |
98 ASSERT_TRUE(immersive_controller->IsRevealed()); | 98 ASSERT_TRUE(immersive_controller->IsRevealed()); |
99 EXPECT_FALSE(ZoomBubbleView::IsShowing()); | 99 EXPECT_TRUE(ZoomBubbleView::zoom_bubble_->GetWidget()->IsClosed()); |
100 | 100 |
101 // The zoom bubble should be anchored when it is shown in immersive fullscreen | 101 // The zoom bubble should be anchored when it is shown in immersive fullscreen |
102 // and the top-of-window views are revealed. | 102 // and the top-of-window views are revealed. |
103 ZoomBubbleView::ShowBubble(web_contents, true); | 103 ZoomBubbleView::ShowBubble(web_contents, true); |
104 ASSERT_TRUE(ZoomBubbleView::IsShowing()); | 104 ASSERT_TRUE(ZoomBubbleView::IsShowing()); |
105 zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest(); | 105 zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest(); |
106 EXPECT_TRUE(zoom_bubble->GetAnchorView()); | 106 EXPECT_TRUE(zoom_bubble->GetAnchorView()); |
107 | 107 |
108 // The top-of-window views should not hide till the zoom bubble hides. (It | 108 // The top-of-window views should not hide till the zoom bubble hides. (It |
109 // would be weird if the view to which the zoom bubble is anchored hid while | 109 // would be weird if the view to which the zoom bubble is anchored hid while |
110 // the zoom bubble was still visible.) | 110 // the zoom bubble was still visible.) |
111 immersive_reveal_lock.reset(); | 111 immersive_reveal_lock.reset(); |
112 EXPECT_TRUE(immersive_controller->IsRevealed()); | 112 EXPECT_TRUE(immersive_controller->IsRevealed()); |
113 ZoomBubbleView::CloseBubble(); | 113 ZoomBubbleView::CloseBubble(); |
114 // The zoom bubble is deleted on a task. | 114 // The zoom bubble is deleted on a task. |
115 content::RunAllPendingInMessageLoop(); | 115 content::RunAllPendingInMessageLoop(); |
116 EXPECT_FALSE(immersive_controller->IsRevealed()); | 116 EXPECT_FALSE(immersive_controller->IsRevealed()); |
117 | 117 |
118 // Exit fullscreen before ending the test for the sake of sanity. | 118 // Exit fullscreen before ending the test for the sake of sanity. |
119 { | 119 { |
120 scoped_ptr<FullscreenNotificationObserver> waiter( | 120 scoped_ptr<FullscreenNotificationObserver> waiter( |
121 new FullscreenNotificationObserver()); | 121 new FullscreenNotificationObserver()); |
122 chrome::ToggleFullscreenMode(browser()); | 122 chrome::ToggleFullscreenMode(browser()); |
123 waiter->Wait(); | 123 waiter->Wait(); |
124 } | 124 } |
125 } | 125 } |
126 #endif // OS_CHROMEOS | 126 #endif // OS_CHROMEOS |
OLD | NEW |