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/memory/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" |
11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
13 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 13 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
14 #include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h" | 14 #include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h" |
15 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 15 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
16 #import "content/public/browser/web_contents.h" | 16 #import "content/public/browser/web_contents.h" |
17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (delegate_) | 103 if (delegate_) |
104 delete delegate_; | 104 delete delegate_; |
105 CocoaProfileTest::TearDown(); | 105 CocoaProfileTest::TearDown(); |
106 } | 106 } |
107 | 107 |
108 protected: | 108 protected: |
109 // Hopefully-obvious: If this returns true, you must not deref |delegate_|! | 109 // Hopefully-obvious: If this returns true, you must not deref |delegate_|! |
110 bool delegate_closed() const { return delegate_ == NULL; } | 110 bool delegate_closed() const { return delegate_ == NULL; } |
111 | 111 |
112 MockConfirmInfoBarDelegate* delegate_; // Owns itself. | 112 MockConfirmInfoBarDelegate* delegate_; // Owns itself. |
113 scoped_nsobject<id> container_; | 113 base::scoped_nsobject<id> container_; |
114 scoped_nsobject<ConfirmInfoBarController> controller_; | 114 base::scoped_nsobject<ConfirmInfoBarController> controller_; |
115 bool closed_delegate_ok_clicked_; | 115 bool closed_delegate_ok_clicked_; |
116 bool closed_delegate_cancel_clicked_; | 116 bool closed_delegate_cancel_clicked_; |
117 bool closed_delegate_link_clicked_; | 117 bool closed_delegate_link_clicked_; |
118 | 118 |
119 private: | 119 private: |
120 virtual void OnInfoBarDelegateClosed() OVERRIDE { | 120 virtual void OnInfoBarDelegateClosed() OVERRIDE { |
121 closed_delegate_ok_clicked_ = delegate_->ok_clicked(); | 121 closed_delegate_ok_clicked_ = delegate_->ok_clicked(); |
122 closed_delegate_cancel_clicked_ = delegate_->cancel_clicked(); | 122 closed_delegate_cancel_clicked_ = delegate_->cancel_clicked(); |
123 closed_delegate_link_clicked_ = delegate_->link_clicked(); | 123 closed_delegate_link_clicked_ = delegate_->link_clicked(); |
124 delegate_ = NULL; | 124 delegate_ = NULL; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 const CGFloat width = 20; | 222 const CGFloat width = 20; |
223 NSRect newViewFrame = [[controller_ view] frame]; | 223 NSRect newViewFrame = [[controller_ view] frame]; |
224 newViewFrame.size.width += width; | 224 newViewFrame.size.width += width; |
225 [[controller_ view] setFrame:newViewFrame]; | 225 [[controller_ view] setFrame:newViewFrame]; |
226 | 226 |
227 NSRect newLabelFrame = [controller_ labelFrame]; | 227 NSRect newLabelFrame = [controller_ labelFrame]; |
228 EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width); | 228 EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width); |
229 } | 229 } |
230 | 230 |
231 } // namespace | 231 } // namespace |
OLD | NEW |