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

Side by Side Diff: chrome/browser/cocoa/extensions/browser_actions_container_view_unittest.mm

Issue 2426002: [Mac] Updates the unit test with some minor tweaks to the Browser Actions con... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 6 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
« no previous file with comments | « chrome/browser/cocoa/extensions/browser_actions_container_view.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_nsobject.h" 5 #include "base/scoped_nsobject.h"
6 #import "chrome/browser/cocoa/cocoa_test_helper.h" 6 #import "chrome/browser/cocoa/cocoa_test_helper.h"
7 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" 7 #import "chrome/browser/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 15
15 class BrowserActionsContainerViewTest : public CocoaTest { 16 class BrowserActionsContainerViewTest : public CocoaTest {
16 public: 17 public:
17 virtual void SetUp() { 18 virtual void SetUp() {
18 CocoaTest::SetUp(); 19 CocoaTest::SetUp();
19 view_.reset([[BrowserActionsContainerView alloc] 20 view_.reset([[BrowserActionsContainerView alloc]
20 initWithFrame:NSMakeRect(0, 0, 0, kContainerHeight)]); 21 initWithFrame:NSMakeRect(0, 0, 0, kContainerHeight)]);
21 } 22 }
22 23
23 scoped_nsobject<BrowserActionsContainerView> view_; 24 scoped_nsobject<BrowserActionsContainerView> view_;
24 }; 25 };
25 26
26 TEST_F(BrowserActionsContainerViewTest, BasicTests) { 27 TEST_F(BrowserActionsContainerViewTest, BasicTests) {
27 EXPECT_TRUE([view_ isResizable]); 28 EXPECT_TRUE([view_ isResizable]);
28 EXPECT_TRUE([view_ canDragLeft]); 29 EXPECT_TRUE([view_ canDragLeft]);
29 EXPECT_TRUE([view_ canDragRight]); 30 EXPECT_TRUE([view_ canDragRight]);
30 EXPECT_TRUE([view_ isHidden]); 31 EXPECT_TRUE([view_ isHidden]);
31 } 32 }
32 33
34 TEST_F(BrowserActionsContainerViewTest, SetWidthTests) {
35 // Try setting below the minimum width (10 pixels).
36 [view_ resizeToWidth:5.0 animate:NO];
37 EXPECT_EQ(kMinimumContainerWidth, NSWidth([view_ frame])) << "Frame width is "
38 << "less than the minimum allowed.";
39 // Since the frame expands to the left, the x-position delta value will be
40 // negative.
41 EXPECT_EQ(-kMinimumContainerWidth, [view_ resizeDeltaX]);
42
43 [view_ resizeToWidth:35.0 animate:NO];
44 EXPECT_EQ(35.0, NSWidth([view_ frame]));
45 EXPECT_EQ(-25.0, [view_ resizeDeltaX]);
46
47 [view_ resizeToWidth:20.0 animate:NO];
48 EXPECT_EQ(20.0, NSWidth([view_ frame]));
49 EXPECT_EQ(15.0, [view_ resizeDeltaX]);
50 }
51
33 } // namespace 52 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/extensions/browser_actions_container_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698