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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
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 "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
(...skipping 19 matching lines...) Expand all
30 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC); 30 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
31 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 31 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
32 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble(); 32 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble();
33 EXPECT_TRUE(zoom_bubble->GetAnchorView()); 33 EXPECT_TRUE(zoom_bubble->GetAnchorView());
34 34
35 // Entering fullscreen should close the bubble. (We enter into tab fullscreen 35 // Entering fullscreen should close the bubble. (We enter into tab fullscreen
36 // here because tab fullscreen is non-immersive even on Chrome OS.) 36 // here because tab fullscreen is non-immersive even on Chrome OS.)
37 { 37 {
38 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. Wait for the 38 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. Wait for the
39 // notification before testing the zoom bubble visibility. 39 // notification before testing the zoom bubble visibility.
40 scoped_ptr<FullscreenNotificationObserver> waiter( 40 std::unique_ptr<FullscreenNotificationObserver> waiter(
41 new FullscreenNotificationObserver()); 41 new FullscreenNotificationObserver());
42 browser() 42 browser()
43 ->exclusive_access_manager() 43 ->exclusive_access_manager()
44 ->fullscreen_controller() 44 ->fullscreen_controller()
45 ->EnterFullscreenModeForTab(web_contents, GURL()); 45 ->EnterFullscreenModeForTab(web_contents, GURL());
46 waiter->Wait(); 46 waiter->Wait();
47 } 47 }
48 ASSERT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); 48 ASSERT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
49 EXPECT_FALSE(ZoomBubbleView::GetZoomBubble()); 49 EXPECT_FALSE(ZoomBubbleView::GetZoomBubble());
50 50
51 // The bubble should not be anchored when it is shown in non-immersive 51 // The bubble should not be anchored when it is shown in non-immersive
52 // fullscreen. 52 // fullscreen.
53 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC); 53 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
54 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 54 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
55 zoom_bubble = ZoomBubbleView::GetZoomBubble(); 55 zoom_bubble = ZoomBubbleView::GetZoomBubble();
56 EXPECT_FALSE(zoom_bubble->GetAnchorView()); 56 EXPECT_FALSE(zoom_bubble->GetAnchorView());
57 57
58 // Exit fullscreen before ending the test for the sake of sanity. 58 // Exit fullscreen before ending the test for the sake of sanity.
59 { 59 {
60 scoped_ptr<FullscreenNotificationObserver> waiter( 60 std::unique_ptr<FullscreenNotificationObserver> waiter(
61 new FullscreenNotificationObserver()); 61 new FullscreenNotificationObserver());
62 chrome::ToggleFullscreenMode(browser()); 62 chrome::ToggleFullscreenMode(browser());
63 waiter->Wait(); 63 waiter->Wait();
64 } 64 }
65 } 65 }
66 66
67 // TODO(zturner): Change this to USE_ASH after fixing the test on Windows. 67 // TODO(zturner): Change this to USE_ASH after fixing the test on Windows.
68 #if defined(OS_CHROMEOS) 68 #if defined(OS_CHROMEOS)
69 // Test whether the zoom bubble is anchored and whether it is visible when in 69 // Test whether the zoom bubble is anchored and whether it is visible when in
70 // immersive fullscreen. 70 // immersive fullscreen.
71 IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) { 71 IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) {
72 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); 72 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
73 content::WebContents* web_contents = browser_view->GetActiveWebContents(); 73 content::WebContents* web_contents = browser_view->GetActiveWebContents();
74 74
75 ImmersiveModeController* immersive_controller = 75 ImmersiveModeController* immersive_controller =
76 browser_view->immersive_mode_controller(); 76 browser_view->immersive_mode_controller();
77 immersive_controller->SetupForTest(); 77 immersive_controller->SetupForTest();
78 78
79 // Enter immersive fullscreen. 79 // Enter immersive fullscreen.
80 { 80 {
81 scoped_ptr<FullscreenNotificationObserver> waiter( 81 std::unique_ptr<FullscreenNotificationObserver> waiter(
82 new FullscreenNotificationObserver()); 82 new FullscreenNotificationObserver());
83 chrome::ToggleFullscreenMode(browser()); 83 chrome::ToggleFullscreenMode(browser());
84 waiter->Wait(); 84 waiter->Wait();
85 } 85 }
86 ASSERT_TRUE(immersive_controller->IsEnabled()); 86 ASSERT_TRUE(immersive_controller->IsEnabled());
87 ASSERT_FALSE(immersive_controller->IsRevealed()); 87 ASSERT_FALSE(immersive_controller->IsRevealed());
88 88
89 // The zoom bubble should not be anchored when it is shown in immersive 89 // The zoom bubble should not be anchored when it is shown in immersive
90 // fullscreen and the top-of-window views are not revealed. 90 // fullscreen and the top-of-window views are not revealed.
91 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC); 91 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
92 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble()); 92 ASSERT_TRUE(ZoomBubbleView::GetZoomBubble());
93 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble(); 93 const ZoomBubbleView* zoom_bubble = ZoomBubbleView::GetZoomBubble();
94 EXPECT_FALSE(zoom_bubble->GetAnchorView()); 94 EXPECT_FALSE(zoom_bubble->GetAnchorView());
95 95
96 // An immersive reveal should hide the zoom bubble. 96 // An immersive reveal should hide the zoom bubble.
97 scoped_ptr<ImmersiveRevealedLock> immersive_reveal_lock( 97 std::unique_ptr<ImmersiveRevealedLock> immersive_reveal_lock(
98 immersive_controller->GetRevealedLock( 98 immersive_controller->GetRevealedLock(
99 ImmersiveModeController::ANIMATE_REVEAL_NO)); 99 ImmersiveModeController::ANIMATE_REVEAL_NO));
100 ASSERT_TRUE(immersive_controller->IsRevealed()); 100 ASSERT_TRUE(immersive_controller->IsRevealed());
101 EXPECT_EQ(NULL, ZoomBubbleView::zoom_bubble_); 101 EXPECT_EQ(NULL, ZoomBubbleView::zoom_bubble_);
102 102
103 // The zoom bubble should be anchored when it is shown in immersive fullscreen 103 // The zoom bubble should be anchored when it is shown in immersive fullscreen
104 // and the top-of-window views are revealed. 104 // and the top-of-window views are revealed.
105 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC); 105 ZoomBubbleView::ShowBubble(web_contents, ZoomBubbleView::AUTOMATIC);
106 zoom_bubble = ZoomBubbleView::GetZoomBubble(); 106 zoom_bubble = ZoomBubbleView::GetZoomBubble();
107 ASSERT_TRUE(zoom_bubble); 107 ASSERT_TRUE(zoom_bubble);
108 EXPECT_TRUE(zoom_bubble->GetAnchorView()); 108 EXPECT_TRUE(zoom_bubble->GetAnchorView());
109 109
110 // The top-of-window views should not hide till the zoom bubble hides. (It 110 // The top-of-window views should not hide till the zoom bubble hides. (It
111 // would be weird if the view to which the zoom bubble is anchored hid while 111 // would be weird if the view to which the zoom bubble is anchored hid while
112 // the zoom bubble was still visible.) 112 // the zoom bubble was still visible.)
113 immersive_reveal_lock.reset(); 113 immersive_reveal_lock.reset();
114 EXPECT_TRUE(immersive_controller->IsRevealed()); 114 EXPECT_TRUE(immersive_controller->IsRevealed());
115 ZoomBubbleView::CloseCurrentBubble(); 115 ZoomBubbleView::CloseCurrentBubble();
116 // The zoom bubble is deleted on a task. 116 // The zoom bubble is deleted on a task.
117 content::RunAllPendingInMessageLoop(); 117 content::RunAllPendingInMessageLoop();
118 EXPECT_FALSE(immersive_controller->IsRevealed()); 118 EXPECT_FALSE(immersive_controller->IsRevealed());
119 119
120 // Exit fullscreen before ending the test for the sake of sanity. 120 // Exit fullscreen before ending the test for the sake of sanity.
121 { 121 {
122 scoped_ptr<FullscreenNotificationObserver> waiter( 122 std::unique_ptr<FullscreenNotificationObserver> waiter(
123 new FullscreenNotificationObserver()); 123 new FullscreenNotificationObserver());
124 chrome::ToggleFullscreenMode(browser()); 124 chrome::ToggleFullscreenMode(browser());
125 waiter->Wait(); 125 waiter->Wait();
126 } 126 }
127 } 127 }
128 #endif // OS_CHROMEOS 128 #endif // OS_CHROMEOS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698