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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/zoom_decoration_browsertest.mm

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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" 5 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (should_quit_on_zoom_) { 67 if (should_quit_on_zoom_) {
68 base::MessageLoop::current()->PostTask( 68 base::MessageLoop::current()->PostTask(
69 FROM_HERE, 69 FROM_HERE,
70 base::Bind(&base::MessageLoop::QuitWhenIdle, 70 base::Bind(&base::MessageLoop::QuitWhenIdle,
71 base::Unretained(base::MessageLoop::current()))); 71 base::Unretained(base::MessageLoop::current())));
72 } 72 }
73 } 73 }
74 74
75 private: 75 private:
76 bool should_quit_on_zoom_; 76 bool should_quit_on_zoom_;
77 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; 77 std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(ZoomDecorationTest); 79 DISALLOW_COPY_AND_ASSIGN(ZoomDecorationTest);
80 }; 80 };
81 81
82 IN_PROC_BROWSER_TEST_F(ZoomDecorationTest, BubbleAtDefaultZoom) { 82 IN_PROC_BROWSER_TEST_F(ZoomDecorationTest, BubbleAtDefaultZoom) {
83 ZoomDecoration* zoom_decoration = GetZoomDecoration(); 83 ZoomDecoration* zoom_decoration = GetZoomDecoration();
84 84
85 // TODO(wjmaclean): This shouldn't be necessary, but at present this test 85 // TODO(wjmaclean): This shouldn't be necessary, but at present this test
86 // assumes the various Zoom() calls do not invoke a notification 86 // assumes the various Zoom() calls do not invoke a notification
87 // bubble, which prior to https://codereview.chromium.org/940673002/ 87 // bubble, which prior to https://codereview.chromium.org/940673002/
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 EXPECT_FALSE(zoom_decoration->IsVisible()); 137 EXPECT_FALSE(zoom_decoration->IsVisible());
138 } 138 }
139 139
140 IN_PROC_BROWSER_TEST_F(ZoomDecorationTest, HideOnInputProgress) { 140 IN_PROC_BROWSER_TEST_F(ZoomDecorationTest, HideOnInputProgress) {
141 ZoomDecoration* zoom_decoration = GetZoomDecoration(); 141 ZoomDecoration* zoom_decoration = GetZoomDecoration();
142 142
143 // Zoom in and reset. 143 // Zoom in and reset.
144 Zoom(content::PAGE_ZOOM_IN); 144 Zoom(content::PAGE_ZOOM_IN);
145 EXPECT_TRUE(zoom_decoration->IsVisible()); 145 EXPECT_TRUE(zoom_decoration->IsVisible());
146 146
147 scoped_ptr<ToolbarModel> toolbar_model(new TestToolbarModel); 147 std::unique_ptr<ToolbarModel> toolbar_model(new TestToolbarModel);
148 toolbar_model->set_input_in_progress(true); 148 toolbar_model->set_input_in_progress(true);
149 browser()->swap_toolbar_models(&toolbar_model); 149 browser()->swap_toolbar_models(&toolbar_model);
150 GetLocationBar()->ZoomChangedForActiveTab(false); 150 GetLocationBar()->ZoomChangedForActiveTab(false);
151 EXPECT_FALSE(zoom_decoration->IsVisible()); 151 EXPECT_FALSE(zoom_decoration->IsVisible());
152 } 152 }
153 153
154 IN_PROC_BROWSER_TEST_F(ZoomDecorationTest, CloseBrowserWithOpenBubble) { 154 IN_PROC_BROWSER_TEST_F(ZoomDecorationTest, CloseBrowserWithOpenBubble) {
155 chrome::SetZoomBubbleAutoCloseDelayForTesting(0); 155 chrome::SetZoomBubbleAutoCloseDelayForTesting(0);
156 156
157 // Create a new browser so that it can be closed properly. 157 // Create a new browser so that it can be closed properly.
158 Browser* browser2 = CreateBrowser(browser()->profile()); 158 Browser* browser2 = CreateBrowser(browser()->profile());
159 ZoomDecoration* zoom_decoration = GetZoomDecorationForBrowser(browser2); 159 ZoomDecoration* zoom_decoration = GetZoomDecorationForBrowser(browser2);
160 zoom_decoration->ShowBubble(true); 160 zoom_decoration->ShowBubble(true);
161 161
162 // Test shouldn't crash. 162 // Test shouldn't crash.
163 browser2->window()->Close(); 163 browser2->window()->Close();
164 content::RunAllPendingInMessageLoop(); 164 content::RunAllPendingInMessageLoop();
165 } 165 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/page_action_decoration.h ('k') | chrome/browser/ui/cocoa/login_handler_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698