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

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

Issue 712993004: Don't re-use a zoom bubble unless it has the same web-contents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore WindowClosing(), improve comments. Created 6 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/zoom_bubble_view.cc ('k') | 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 "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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ZoomBubbleView::ShowBubble(web_contents, true); 88 ZoomBubbleView::ShowBubble(web_contents, true);
89 ASSERT_TRUE(ZoomBubbleView::IsShowing()); 89 ASSERT_TRUE(ZoomBubbleView::IsShowing());
90 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest(); 90 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest();
91 EXPECT_FALSE(zoom_bubble->GetAnchorView()); 91 EXPECT_FALSE(zoom_bubble->GetAnchorView());
92 92
93 // An immersive reveal should hide the zoom bubble. 93 // An immersive reveal should hide the zoom bubble.
94 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( 94 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock(
95 immersive_controller->GetRevealedLock( 95 immersive_controller->GetRevealedLock(
96 ImmersiveModeController::ANIMATE_REVEAL_NO)); 96 ImmersiveModeController::ANIMATE_REVEAL_NO));
97 ASSERT_TRUE(immersive_controller->IsRevealed()); 97 ASSERT_TRUE(immersive_controller->IsRevealed());
98 EXPECT_TRUE(ZoomBubbleView::zoom_bubble_->GetWidget()->IsClosed()); 98 EXPECT_EQ(NULL, ZoomBubbleView::zoom_bubble_);
99 99
100 // The zoom bubble should be anchored when it is shown in immersive fullscreen 100 // The zoom bubble should be anchored when it is shown in immersive fullscreen
101 // and the top-of-window views are revealed. 101 // and the top-of-window views are revealed.
102 ZoomBubbleView::ShowBubble(web_contents, true); 102 ZoomBubbleView::ShowBubble(web_contents, true);
103 ASSERT_TRUE(ZoomBubbleView::IsShowing()); 103 ASSERT_TRUE(ZoomBubbleView::IsShowing());
104 zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest(); 104 zoom_bubble = ZoomBubbleView::GetZoomBubbleForTest();
105 EXPECT_TRUE(zoom_bubble->GetAnchorView()); 105 EXPECT_TRUE(zoom_bubble->GetAnchorView());
106 106
107 // The top-of-window views should not hide till the zoom bubble hides. (It 107 // The top-of-window views should not hide till the zoom bubble hides. (It
108 // would be weird if the view to which the zoom bubble is anchored hid while 108 // would be weird if the view to which the zoom bubble is anchored hid while
109 // the zoom bubble was still visible.) 109 // the zoom bubble was still visible.)
110 immersive_reveal_lock.reset(); 110 immersive_reveal_lock.reset();
111 EXPECT_TRUE(immersive_controller->IsRevealed()); 111 EXPECT_TRUE(immersive_controller->IsRevealed());
112 ZoomBubbleView::CloseBubble(); 112 ZoomBubbleView::CloseBubble();
113 // The zoom bubble is deleted on a task. 113 // The zoom bubble is deleted on a task.
114 content::RunAllPendingInMessageLoop(); 114 content::RunAllPendingInMessageLoop();
115 EXPECT_FALSE(immersive_controller->IsRevealed()); 115 EXPECT_FALSE(immersive_controller->IsRevealed());
116 116
117 // Exit fullscreen before ending the test for the sake of sanity. 117 // Exit fullscreen before ending the test for the sake of sanity.
118 { 118 {
119 scoped_ptr<FullscreenNotificationObserver> waiter( 119 scoped_ptr<FullscreenNotificationObserver> waiter(
120 new FullscreenNotificationObserver()); 120 new FullscreenNotificationObserver());
121 chrome::ToggleFullscreenMode(browser()); 121 chrome::ToggleFullscreenMode(browser());
122 waiter->Wait(); 122 waiter->Wait();
123 } 123 }
124 } 124 }
125 #endif // OS_CHROMEOS 125 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/zoom_bubble_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698