Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "base/scoped_nsautorelease_pool.h" | 7 #include "base/scoped_nsautorelease_pool.h" |
| 8 #import "base/scoped_nsobject.h" | 8 #import "base/scoped_nsobject.h" |
| 9 #import "chrome/browser/cocoa/tab_controller.h" | 9 #import "chrome/browser/cocoa/tab_controller.h" |
| 10 #import "chrome/browser/cocoa/tab_controller_target.h" | 10 #import "chrome/browser/cocoa/tab_controller_target.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 scoped_nsobject<TabController> controller([[TabController alloc] init]); | 100 scoped_nsobject<TabController> controller([[TabController alloc] init]); |
| 101 [[window contentView] addSubview:[controller view]]; | 101 [[window contentView] addSubview:[controller view]]; |
| 102 | 102 |
| 103 EXPECT_FALSE([controller selected]); | 103 EXPECT_FALSE([controller selected]); |
| 104 [controller setSelected:YES]; | 104 [controller setSelected:YES]; |
| 105 EXPECT_TRUE([controller selected]); | 105 EXPECT_TRUE([controller selected]); |
| 106 | 106 |
| 107 [[controller view] removeFromSuperview]; | 107 [[controller view] removeFromSuperview]; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Tests that setting the title of a tab sets the tooltip as well. | |
|
John Grabowski
2009/06/02 00:10:51
u de man jeremy.
| |
| 111 TEST_F(TabControllerTest, ToolTip) { | |
| 112 NSWindow* window = cocoa_helper_.window(); | |
| 113 | |
| 114 scoped_nsobject<TabController> controller([[TabController alloc] init]); | |
| 115 [[window contentView] addSubview:[controller view]]; | |
| 116 | |
| 117 EXPECT_TRUE([[controller toolTip] length] == 0); | |
| 118 NSString *tooltip_string = @"Some text to use as a tab title"; | |
| 119 [controller setTitle:tooltip_string]; | |
| 120 EXPECT_TRUE([tooltip_string isEqualToString:[controller toolTip]]); | |
| 121 } | |
| 122 | |
| 110 // Tests setting the |loading| property via code. | 123 // Tests setting the |loading| property via code. |
| 111 TEST_F(TabControllerTest, Loading) { | 124 TEST_F(TabControllerTest, Loading) { |
| 112 NSWindow* window = cocoa_helper_.window(); | 125 NSWindow* window = cocoa_helper_.window(); |
| 113 scoped_nsobject<TabController> controller([[TabController alloc] init]); | 126 scoped_nsobject<TabController> controller([[TabController alloc] init]); |
| 114 [[window contentView] addSubview:[controller view]]; | 127 [[window contentView] addSubview:[controller view]]; |
| 115 | 128 |
| 116 EXPECT_FALSE([controller loading]); | 129 EXPECT_FALSE([controller loading]); |
| 117 [controller setLoading:YES]; | 130 [controller setLoading:YES]; |
| 118 EXPECT_TRUE([controller loading]); | 131 EXPECT_TRUE([controller loading]); |
| 119 | 132 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 pressure:1.0]; | 183 pressure:1.0]; |
| 171 [[controller view] mouseDown:down]; | 184 [[controller view] mouseDown:down]; |
| 172 | 185 |
| 173 // Check our target was told the tab got selected. | 186 // Check our target was told the tab got selected. |
| 174 EXPECT_TRUE([target selected]); | 187 EXPECT_TRUE([target selected]); |
| 175 | 188 |
| 176 [[controller view] removeFromSuperview]; | 189 [[controller view] removeFromSuperview]; |
| 177 } | 190 } |
| 178 | 191 |
| 179 } // namespace | 192 } // namespace |
| OLD | NEW |