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

Side by Side Diff: chrome/browser/cocoa/tab_controller_unittest.mm

Issue 3095004: [Mac] Use the new {EXPECT,ASSERT}_NS{EQ,NE} macros where possible. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix compile Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/tab_controller.h" 8 #import "chrome/browser/cocoa/tab_controller.h"
9 #import "chrome/browser/cocoa/tab_controller_target.h" 9 #import "chrome/browser/cocoa/tab_controller_target.h"
10 #include "chrome/browser/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/cocoa/cocoa_test_helper.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #import "testing/gtest_mac.h"
12 #include "testing/platform_test.h" 13 #include "testing/platform_test.h"
13 14
14 // Implements the target interface for the tab, which gets sent messages when 15 // Implements the target interface for the tab, which gets sent messages when
15 // the tab is clicked on by the user and when its close box is clicked. 16 // the tab is clicked on by the user and when its close box is clicked.
16 @interface TabControllerTestTarget : NSObject<TabControllerTarget> { 17 @interface TabControllerTestTarget : NSObject<TabControllerTarget> {
17 @private 18 @private
18 bool selected_; 19 bool selected_;
19 bool closed_; 20 bool closed_;
20 } 21 }
21 - (bool)selected; 22 - (bool)selected;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Tests that setting the title of a tab sets the tooltip as well. 115 // Tests that setting the title of a tab sets the tooltip as well.
115 TEST_F(TabControllerTest, ToolTip) { 116 TEST_F(TabControllerTest, ToolTip) {
116 NSWindow* window = test_window(); 117 NSWindow* window = test_window();
117 118
118 scoped_nsobject<TabController> controller([[TabController alloc] init]); 119 scoped_nsobject<TabController> controller([[TabController alloc] init]);
119 [[window contentView] addSubview:[controller view]]; 120 [[window contentView] addSubview:[controller view]];
120 121
121 EXPECT_TRUE([[controller toolTip] length] == 0); 122 EXPECT_TRUE([[controller toolTip] length] == 0);
122 NSString *tooltip_string = @"Some text to use as a tab title"; 123 NSString *tooltip_string = @"Some text to use as a tab title";
123 [controller setTitle:tooltip_string]; 124 [controller setTitle:tooltip_string];
124 EXPECT_TRUE([tooltip_string isEqualToString:[controller toolTip]]); 125 EXPECT_NSEQ(tooltip_string, [controller toolTip]);
125 } 126 }
126 127
127 // Tests setting the |loading| property via code. 128 // Tests setting the |loading| property via code.
128 TEST_F(TabControllerTest, Loading) { 129 TEST_F(TabControllerTest, Loading) {
129 NSWindow* window = test_window(); 130 NSWindow* window = test_window();
130 scoped_nsobject<TabController> controller([[TabController alloc] init]); 131 scoped_nsobject<TabController> controller([[TabController alloc] init]);
131 [[window contentView] addSubview:[controller view]]; 132 [[window contentView] addSubview:[controller view]];
132 133
133 EXPECT_EQ(kTabDone, [controller loadingState]); 134 EXPECT_EQ(kTabDone, [controller loadingState]);
134 [controller setLoadingState:kTabWaiting]; 135 [controller setLoadingState:kTabWaiting];
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 int cap = [controller iconCapacity]; 259 int cap = [controller iconCapacity];
259 EXPECT_GT(cap, 0); 260 EXPECT_GT(cap, 0);
260 261
261 // Asking the view for its menu should yield a valid menu. 262 // Asking the view for its menu should yield a valid menu.
262 NSMenu* menu = [[controller view] menu]; 263 NSMenu* menu = [[controller view] menu];
263 EXPECT_TRUE(menu); 264 EXPECT_TRUE(menu);
264 EXPECT_GT([menu numberOfItems], 0); 265 EXPECT_GT([menu numberOfItems], 0);
265 } 266 }
266 267
267 } // namespace 268 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698