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 #include "base/memory/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
6 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 7 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 class FastResizeViewTest : public CocoaTest { | 11 class FastResizeViewTest : public CocoaTest { |
12 public: | 12 public: |
13 FastResizeViewTest() { | 13 FastResizeViewTest() { |
14 NSRect frame = NSMakeRect(0, 0, 100, 30); | 14 NSRect frame = NSMakeRect(0, 0, 100, 30); |
15 scoped_nsobject<FastResizeView> view( | 15 base::scoped_nsobject<FastResizeView> view( |
16 [[FastResizeView alloc] initWithFrame:frame]); | 16 [[FastResizeView alloc] initWithFrame:frame]); |
17 view_ = view.get(); | 17 view_ = view.get(); |
18 [[test_window() contentView] addSubview:view_]; | 18 [[test_window() contentView] addSubview:view_]; |
19 | 19 |
20 scoped_nsobject<NSView> childView([[NSView alloc] initWithFrame:frame]); | 20 base::scoped_nsobject<NSView> childView( |
| 21 [[NSView alloc] initWithFrame:frame]); |
21 childView_ = childView.get(); | 22 childView_ = childView.get(); |
22 [view_ addSubview:childView_]; | 23 [view_ addSubview:childView_]; |
23 } | 24 } |
24 | 25 |
25 FastResizeView* view_; | 26 FastResizeView* view_; |
26 NSView* childView_; | 27 NSView* childView_; |
27 }; | 28 }; |
28 | 29 |
29 TEST_VIEW(FastResizeViewTest, view_); | 30 TEST_VIEW(FastResizeViewTest, view_); |
30 | 31 |
(...skipping 20 matching lines...) Expand all Loading... |
51 EXPECT_EQ(NSMaxY([view_ bounds]), NSMaxY([childView_ frame])); | 52 EXPECT_EQ(NSMaxY([view_ bounds]), NSMaxY([childView_ frame])); |
52 | 53 |
53 // Turn fast resize mode off. This should initiate an immediate resize, even | 54 // Turn fast resize mode off. This should initiate an immediate resize, even |
54 // though we haven't called setFrame directly. | 55 // though we haven't called setFrame directly. |
55 [view_ setFastResizeMode:NO]; | 56 [view_ setFastResizeMode:NO]; |
56 EXPECT_TRUE(NSEqualRects([view_ frame], rectFrame)); | 57 EXPECT_TRUE(NSEqualRects([view_ frame], rectFrame)); |
57 EXPECT_TRUE(NSEqualRects([view_ bounds], [childView_ frame])); | 58 EXPECT_TRUE(NSEqualRects([view_ bounds], [childView_ frame])); |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace |
OLD | NEW |