Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/ui/cocoa/animatable_view_unittest.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/mac/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/animatable_view.h" 8 #import "chrome/browser/ui/cocoa/animatable_view.h"
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" 10 #import "chrome/browser/ui/cocoa/view_resizer_pong.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
13 13
14 namespace { 14 namespace {
15 15
16 class AnimatableViewTest : public CocoaTest { 16 class AnimatableViewTest : public CocoaTest {
17 public: 17 public:
18 AnimatableViewTest() { 18 AnimatableViewTest() {
19 NSRect frame = NSMakeRect(0, 0, 100, 100); 19 NSRect frame = NSMakeRect(0, 0, 100, 100);
20 view_.reset([[AnimatableView alloc] initWithFrame:frame]); 20 view_.reset([[AnimatableView alloc] initWithFrame:frame]);
21 [[test_window() contentView] addSubview:view_.get()]; 21 [[test_window() contentView] addSubview:view_.get()];
22 22
23 resizeDelegate_.reset([[ViewResizerPong alloc] init]); 23 resizeDelegate_.reset([[ViewResizerPong alloc] init]);
24 [view_ setResizeDelegate:resizeDelegate_.get()]; 24 [view_ setResizeDelegate:resizeDelegate_.get()];
25 } 25 }
26 26
27 scoped_nsobject<ViewResizerPong> resizeDelegate_; 27 base::scoped_nsobject<ViewResizerPong> resizeDelegate_;
28 scoped_nsobject<AnimatableView> view_; 28 base::scoped_nsobject<AnimatableView> view_;
29 }; 29 };
30 30
31 // Basic view tests (AddRemove, Display). 31 // Basic view tests (AddRemove, Display).
32 TEST_VIEW(AnimatableViewTest, view_); 32 TEST_VIEW(AnimatableViewTest, view_);
33 33
34 TEST_F(AnimatableViewTest, GetAndSetHeight) { 34 TEST_F(AnimatableViewTest, GetAndSetHeight) {
35 // Make sure the view's height starts out at 100. 35 // Make sure the view's height starts out at 100.
36 NSRect initialFrame = [view_ frame]; 36 NSRect initialFrame = [view_ frame];
37 ASSERT_EQ(100, initialFrame.size.height); 37 ASSERT_EQ(100, initialFrame.size.height);
38 EXPECT_EQ(initialFrame.size.height, [view_ height]); 38 EXPECT_EQ(initialFrame.size.height, [view_ height]);
39 39
40 // Set it directly to 50 and make sure it takes effect. 40 // Set it directly to 50 and make sure it takes effect.
41 [resizeDelegate_ setHeight:-1]; 41 [resizeDelegate_ setHeight:-1];
42 [view_ setHeight:50]; 42 [view_ setHeight:50];
43 EXPECT_EQ(50, [resizeDelegate_ height]); 43 EXPECT_EQ(50, [resizeDelegate_ height]);
44 } 44 }
45 45
46 // TODO(rohitrao): Find a way to unittest the animations and delegate messages. 46 // TODO(rohitrao): Find a way to unittest the animations and delegate messages.
47 47
48 } // namespace 48 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698