OLD | NEW |
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 "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Call positionInfoBarsAndResize and check that |resizeDelegate_| got a | 53 // Call positionInfoBarsAndResize and check that |resizeDelegate_| got a |
54 // resize message. | 54 // resize message. |
55 [resizeDelegate_ resizeView:[controller_ view] newHeight:-1]; | 55 [resizeDelegate_ resizeView:[controller_ view] newHeight:-1]; |
56 [controller_ positionInfoBarsAndRedraw:NO]; | 56 [controller_ positionInfoBarsAndRedraw:NO]; |
57 EXPECT_NE(-1, [resizeDelegate_ height]); | 57 EXPECT_NE(-1, [resizeDelegate_ height]); |
58 } | 58 } |
59 | 59 |
60 TEST_F(InfoBarContainerControllerTest, AddAndRemoveInfoBars) { | 60 TEST_F(InfoBarContainerControllerTest, AddAndRemoveInfoBars) { |
61 NSView* view = [controller_ view]; | 61 NSView* view = [controller_ view]; |
62 | 62 |
63 scoped_ptr<InfoBarDelegate> confirm_delegate( | 63 scoped_ptr<infobars::InfoBarDelegate> confirm_delegate( |
64 new MockConfirmInfoBarDelegate(NULL)); | 64 new MockConfirmInfoBarDelegate(NULL)); |
65 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(confirm_delegate.Pass())); | 65 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(confirm_delegate.Pass())); |
66 base::scoped_nsobject<ConfirmInfoBarController> controller( | 66 base::scoped_nsobject<ConfirmInfoBarController> controller( |
67 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); | 67 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); |
68 infobar->set_controller(controller); | 68 infobar->set_controller(controller); |
69 [controller_ addInfoBar:infobar.get() position:0]; | 69 [controller_ addInfoBar:infobar.get() position:0]; |
70 EXPECT_EQ(1U, [[view subviews] count]); | 70 EXPECT_EQ(1U, [[view subviews] count]); |
71 | 71 |
72 [controller_ removeInfoBar:infobar.get()]; | 72 [controller_ removeInfoBar:infobar.get()]; |
73 EXPECT_EQ(0U, [[view subviews] count]); | 73 EXPECT_EQ(0U, [[view subviews] count]); |
74 } | 74 } |
75 | 75 |
76 } // namespace | 76 } // namespace |
OLD | NEW |