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/confirm_infobar_controller.h" | 5 #import "chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 public: | 87 public: |
88 virtual void SetUp() OVERRIDE { | 88 virtual void SetUp() OVERRIDE { |
89 CocoaProfileTest::SetUp(); | 89 CocoaProfileTest::SetUp(); |
90 web_contents_.reset( | 90 web_contents_.reset( |
91 WebContents::Create(WebContents::CreateParams(profile()))); | 91 WebContents::Create(WebContents::CreateParams(profile()))); |
92 InfoBarService::CreateForWebContents(web_contents_.get()); | 92 InfoBarService::CreateForWebContents(web_contents_.get()); |
93 | 93 |
94 scoped_ptr<InfoBarDelegate> delegate( | 94 scoped_ptr<InfoBarDelegate> delegate( |
95 new MockConfirmInfoBarDelegate(this)); | 95 new MockConfirmInfoBarDelegate(this)); |
96 infobar_ = new InfoBarCocoa(delegate.Pass()); | 96 infobar_ = new InfoBarCocoa(delegate.Pass()); |
97 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get())); | 97 infobar_->SetOwner(InfoBarService::FromWebContents( |
| 98 web_contents_.get())->infobar_manager()); |
98 | 99 |
99 controller_.reset([[TestConfirmInfoBarController alloc] | 100 controller_.reset([[TestConfirmInfoBarController alloc] |
100 initWithInfoBar:infobar_]); | 101 initWithInfoBar:infobar_]); |
101 infobar_->set_controller(controller_); | 102 infobar_->set_controller(controller_); |
102 | 103 |
103 container_.reset( | 104 container_.reset( |
104 [[InfoBarContainerTest alloc] initWithController:controller_]); | 105 [[InfoBarContainerTest alloc] initWithController:controller_]); |
105 [controller_ setContainerController:container_]; | 106 [controller_ setContainerController:container_]; |
106 [[test_window() contentView] addSubview:[controller_ view]]; | 107 [[test_window() contentView] addSubview:[controller_ view]]; |
107 closed_delegate_ok_clicked_ = false; | 108 closed_delegate_ok_clicked_ = false; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const CGFloat width = 20; | 239 const CGFloat width = 20; |
239 NSRect newViewFrame = [[controller_ view] frame]; | 240 NSRect newViewFrame = [[controller_ view] frame]; |
240 newViewFrame.size.width += width; | 241 newViewFrame.size.width += width; |
241 [[controller_ view] setFrame:newViewFrame]; | 242 [[controller_ view] setFrame:newViewFrame]; |
242 | 243 |
243 NSRect newLabelFrame = [controller_ labelFrame]; | 244 NSRect newLabelFrame = [controller_ labelFrame]; |
244 EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width); | 245 EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width); |
245 } | 246 } |
246 | 247 |
247 } // namespace | 248 } // namespace |
OLD | NEW |