| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 /////////////////////////////////////////////////////////////////////////// | 95 /////////////////////////////////////////////////////////////////////////// |
| 96 // Test fixtures | 96 // Test fixtures |
| 97 | 97 |
| 98 class LinkInfoBarControllerTest : public CocoaProfileTest, | 98 class LinkInfoBarControllerTest : public CocoaProfileTest, |
| 99 public MockLinkInfoBarDelegate::Owner { | 99 public MockLinkInfoBarDelegate::Owner { |
| 100 public: | 100 public: |
| 101 virtual void SetUp() { | 101 virtual void SetUp() { |
| 102 CocoaProfileTest::SetUp(); | 102 CocoaProfileTest::SetUp(); |
| 103 tab_contents_.reset(new TabContents(WebContents::Create( | 103 tab_contents_.reset(new TabContents(WebContents::Create( |
| 104 profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); | 104 profile(), NULL, MSG_ROUTING_NONE, NULL))); |
| 105 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); | 105 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); |
| 106 | 106 |
| 107 delegate_ = new MockLinkInfoBarDelegate(this); | 107 delegate_ = new MockLinkInfoBarDelegate(this); |
| 108 controller_.reset([[TestLinkInfoBarController alloc] | 108 controller_.reset([[TestLinkInfoBarController alloc] |
| 109 initWithDelegate:delegate_ | 109 initWithDelegate:delegate_ |
| 110 owner:tab_contents_.get()->infobar_tab_helper()]); | 110 owner:tab_contents_.get()->infobar_tab_helper()]); |
| 111 container_.reset( | 111 container_.reset( |
| 112 [[InfoBarContainerTest alloc] initWithController:controller_]); | 112 [[InfoBarContainerTest alloc] initWithController:controller_]); |
| 113 [controller_ setContainerController:container_]; | 113 [controller_ setContainerController:container_]; |
| 114 [[test_window() contentView] addSubview:[controller_ view]]; | 114 [[test_window() contentView] addSubview:[controller_ view]]; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 138 | 138 |
| 139 scoped_ptr<TabContents> tab_contents_; | 139 scoped_ptr<TabContents> tab_contents_; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 class ConfirmInfoBarControllerTest : public CocoaProfileTest, | 142 class ConfirmInfoBarControllerTest : public CocoaProfileTest, |
| 143 public MockConfirmInfoBarDelegate::Owner { | 143 public MockConfirmInfoBarDelegate::Owner { |
| 144 public: | 144 public: |
| 145 virtual void SetUp() { | 145 virtual void SetUp() { |
| 146 CocoaProfileTest::SetUp(); | 146 CocoaProfileTest::SetUp(); |
| 147 tab_contents_.reset(new TabContents(WebContents::Create( | 147 tab_contents_.reset(new TabContents(WebContents::Create( |
| 148 profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); | 148 profile(), NULL, MSG_ROUTING_NONE, NULL))); |
| 149 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); | 149 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); |
| 150 | 150 |
| 151 delegate_ = new MockConfirmInfoBarDelegate(this); | 151 delegate_ = new MockConfirmInfoBarDelegate(this); |
| 152 controller_.reset([[TestConfirmInfoBarController alloc] | 152 controller_.reset([[TestConfirmInfoBarController alloc] |
| 153 initWithDelegate:delegate_ | 153 initWithDelegate:delegate_ |
| 154 owner:tab_contents_.get()->infobar_tab_helper()]); | 154 owner:tab_contents_.get()->infobar_tab_helper()]); |
| 155 container_.reset( | 155 container_.reset( |
| 156 [[InfoBarContainerTest alloc] initWithController:controller_]); | 156 [[InfoBarContainerTest alloc] initWithController:controller_]); |
| 157 [controller_ setContainerController:container_]; | 157 [controller_ setContainerController:container_]; |
| 158 [[test_window() contentView] addSubview:[controller_ view]]; | 158 [[test_window() contentView] addSubview:[controller_ view]]; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 const CGFloat width = 20; | 330 const CGFloat width = 20; |
| 331 NSRect newViewFrame = [[controller_ view] frame]; | 331 NSRect newViewFrame = [[controller_ view] frame]; |
| 332 newViewFrame.size.width += width; | 332 newViewFrame.size.width += width; |
| 333 [[controller_ view] setFrame:newViewFrame]; | 333 [[controller_ view] setFrame:newViewFrame]; |
| 334 | 334 |
| 335 NSRect newLabelFrame = [controller_ labelFrame]; | 335 NSRect newLabelFrame = [controller_ labelFrame]; |
| 336 EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width); | 336 EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace | 339 } // namespace |
| OLD | NEW |