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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_actions_container_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 #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/cocoa_test_helper.h"
7 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" 7 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/platform_test.h" 9 #include "testing/platform_test.h"
10 10
11 namespace { 11 namespace {
12 12
13 const CGFloat kContainerHeight = 15.0; 13 const CGFloat kContainerHeight = 15.0;
14 const CGFloat kMinimumContainerWidth = 10.0; 14 const CGFloat kMinimumContainerWidth = 10.0;
15 15
16 class BrowserActionsContainerViewTest : public CocoaTest { 16 class BrowserActionsContainerViewTest : public CocoaTest {
17 public: 17 public:
18 virtual void SetUp() { 18 virtual void SetUp() {
19 CocoaTest::SetUp(); 19 CocoaTest::SetUp();
20 view_.reset([[BrowserActionsContainerView alloc] 20 view_.reset([[BrowserActionsContainerView alloc]
21 initWithFrame:NSMakeRect(0, 0, 0, kContainerHeight)]); 21 initWithFrame:NSMakeRect(0, 0, 0, kContainerHeight)]);
22 } 22 }
23 23
24 scoped_nsobject<BrowserActionsContainerView> view_; 24 base::scoped_nsobject<BrowserActionsContainerView> view_;
25 }; 25 };
26 26
27 TEST_F(BrowserActionsContainerViewTest, BasicTests) { 27 TEST_F(BrowserActionsContainerViewTest, BasicTests) {
28 EXPECT_TRUE([view_ isResizable]); 28 EXPECT_TRUE([view_ isResizable]);
29 EXPECT_TRUE([view_ canDragLeft]); 29 EXPECT_TRUE([view_ canDragLeft]);
30 EXPECT_TRUE([view_ canDragRight]); 30 EXPECT_TRUE([view_ canDragRight]);
31 EXPECT_TRUE([view_ isHidden]); 31 EXPECT_TRUE([view_ isHidden]);
32 } 32 }
33 33
34 TEST_F(BrowserActionsContainerViewTest, SetWidthTests) { 34 TEST_F(BrowserActionsContainerViewTest, SetWidthTests) {
35 // Try setting below the minimum width (10 pixels). 35 // Try setting below the minimum width (10 pixels).
36 [view_ resizeToWidth:5.0 animate:NO]; 36 [view_ resizeToWidth:5.0 animate:NO];
37 EXPECT_EQ(kMinimumContainerWidth, NSWidth([view_ frame])) << "Frame width is " 37 EXPECT_EQ(kMinimumContainerWidth, NSWidth([view_ frame])) << "Frame width is "
38 << "less than the minimum allowed."; 38 << "less than the minimum allowed.";
39 // Since the frame expands to the left, the x-position delta value will be 39 // Since the frame expands to the left, the x-position delta value will be
40 // negative. 40 // negative.
41 EXPECT_EQ(-kMinimumContainerWidth, [view_ resizeDeltaX]); 41 EXPECT_EQ(-kMinimumContainerWidth, [view_ resizeDeltaX]);
42 42
43 [view_ resizeToWidth:35.0 animate:NO]; 43 [view_ resizeToWidth:35.0 animate:NO];
44 EXPECT_EQ(35.0, NSWidth([view_ frame])); 44 EXPECT_EQ(35.0, NSWidth([view_ frame]));
45 EXPECT_EQ(-25.0, [view_ resizeDeltaX]); 45 EXPECT_EQ(-25.0, [view_ resizeDeltaX]);
46 46
47 [view_ resizeToWidth:20.0 animate:NO]; 47 [view_ resizeToWidth:20.0 animate:NO];
48 EXPECT_EQ(20.0, NSWidth([view_ frame])); 48 EXPECT_EQ(20.0, NSWidth([view_ frame]));
49 EXPECT_EQ(15.0, [view_ resizeDeltaX]); 49 EXPECT_EQ(15.0, [view_ resizeDeltaX]);
50 } 50 }
51 51
52 } // namespace 52 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698