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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/infobars/infobar_container_controller.h" 5 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 void TearDown() override { 40 void TearDown() override {
41 [[controller_ view] removeFromSuperviewWithoutNeedingDisplay]; 41 [[controller_ view] removeFromSuperviewWithoutNeedingDisplay];
42 controller_.reset(); 42 controller_.reset();
43 CocoaProfileTest::TearDown(); 43 CocoaProfileTest::TearDown();
44 } 44 }
45 45
46 public: 46 public:
47 base::scoped_nsobject<ViewResizerPong> resizeDelegate_; 47 base::scoped_nsobject<ViewResizerPong> resizeDelegate_;
48 base::scoped_nsobject<InfoBarContainerController> controller_; 48 base::scoped_nsobject<InfoBarContainerController> controller_;
49 scoped_ptr<content::WebContents> web_contents_; 49 std::unique_ptr<content::WebContents> web_contents_;
50 }; 50 };
51 51
52 TEST_VIEW(InfoBarContainerControllerTest, [controller_ view]) 52 TEST_VIEW(InfoBarContainerControllerTest, [controller_ view])
53 53
54 TEST_F(InfoBarContainerControllerTest, BWCPong) { 54 TEST_F(InfoBarContainerControllerTest, BWCPong) {
55 // Call positionInfoBarsAndResize and check that |resizeDelegate_| got a 55 // Call positionInfoBarsAndResize and check that |resizeDelegate_| got a
56 // resize message. 56 // resize message.
57 [resizeDelegate_ resizeView:[controller_ view] newHeight:-1]; 57 [resizeDelegate_ resizeView:[controller_ view] newHeight:-1];
58 [controller_ positionInfoBarsAndRedraw:NO]; 58 [controller_ positionInfoBarsAndRedraw:NO];
59 EXPECT_NE(-1, [resizeDelegate_ height]); 59 EXPECT_NE(-1, [resizeDelegate_ height]);
60 } 60 }
61 61
62 TEST_F(InfoBarContainerControllerTest, AddAndRemoveInfoBars) { 62 TEST_F(InfoBarContainerControllerTest, AddAndRemoveInfoBars) {
63 NSView* view = [controller_ view]; 63 NSView* view = [controller_ view];
64 64
65 scoped_ptr<infobars::InfoBarDelegate> confirm_delegate( 65 std::unique_ptr<infobars::InfoBarDelegate> confirm_delegate(
66 new MockConfirmInfoBarDelegate(NULL)); 66 new MockConfirmInfoBarDelegate(NULL));
67 scoped_ptr<InfoBarCocoa> infobar( 67 std::unique_ptr<InfoBarCocoa> infobar(
68 new InfoBarCocoa(std::move(confirm_delegate))); 68 new InfoBarCocoa(std::move(confirm_delegate)));
69 base::scoped_nsobject<ConfirmInfoBarController> controller( 69 base::scoped_nsobject<ConfirmInfoBarController> controller(
70 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); 70 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]);
71 infobar->set_controller(controller); 71 infobar->set_controller(controller);
72 [controller_ addInfoBar:infobar.get() position:0]; 72 [controller_ addInfoBar:infobar.get() position:0];
73 EXPECT_EQ(1U, [[view subviews] count]); 73 EXPECT_EQ(1U, [[view subviews] count]);
74 74
75 [controller_ removeInfoBar:infobar.get()]; 75 [controller_ removeInfoBar:infobar.get()];
76 EXPECT_EQ(0U, [[view subviews] count]); 76 EXPECT_EQ(0U, [[view subviews] count]);
77 } 77 }
78 78
79 } // namespace 79 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698