| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 scoped_nsobject<TabStripController> controller_; | 112 scoped_nsobject<TabStripController> controller_; |
| 113 scoped_nsobject<TabStripView> tab_strip_; | 113 scoped_nsobject<TabStripView> tab_strip_; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 // Test adding and removing tabs and making sure that views get added to | 116 // Test adding and removing tabs and making sure that views get added to |
| 117 // the tab strip. | 117 // the tab strip. |
| 118 TEST_F(TabStripControllerTest, AddRemoveTabs) { | 118 TEST_F(TabStripControllerTest, AddRemoveTabs) { |
| 119 EXPECT_TRUE(model_->empty()); | 119 EXPECT_TRUE(model_->empty()); |
| 120 SiteInstance* instance = SiteInstance::Create(profile()); | 120 SiteInstance* instance = SiteInstance::Create(profile()); |
| 121 TabContents* tab_contents = chrome::TabContentsFactory( | 121 TabContents* tab_contents = chrome::TabContentsFactory( |
| 122 profile(), instance, MSG_ROUTING_NONE, NULL, NULL); | 122 profile(), instance, MSG_ROUTING_NONE, NULL); |
| 123 model_->AppendTabContents(tab_contents, true); | 123 model_->AppendTabContents(tab_contents, true); |
| 124 EXPECT_EQ(model_->count(), 1); | 124 EXPECT_EQ(model_->count(), 1); |
| 125 } | 125 } |
| 126 | 126 |
| 127 TEST_F(TabStripControllerTest, SelectTab) { | 127 TEST_F(TabStripControllerTest, SelectTab) { |
| 128 // TODO(pinkerton): Implement http://crbug.com/10899 | 128 // TODO(pinkerton): Implement http://crbug.com/10899 |
| 129 } | 129 } |
| 130 | 130 |
| 131 TEST_F(TabStripControllerTest, RearrangeTabs) { | 131 TEST_F(TabStripControllerTest, RearrangeTabs) { |
| 132 // TODO(pinkerton): Implement http://crbug.com/10899 | 132 // TODO(pinkerton): Implement http://crbug.com/10899 |
| 133 } | 133 } |
| 134 | 134 |
| 135 TEST_F(TabStripControllerTest, CorrectToolTipText) { | 135 TEST_F(TabStripControllerTest, CorrectToolTipText) { |
| 136 // Create tab 1. | 136 // Create tab 1. |
| 137 SiteInstance* instance = SiteInstance::Create(profile()); | 137 SiteInstance* instance = SiteInstance::Create(profile()); |
| 138 TabContents* tab_contents = chrome::TabContentsFactory( | 138 TabContents* tab_contents = chrome::TabContentsFactory( |
| 139 profile(), instance, MSG_ROUTING_NONE, NULL, NULL); | 139 profile(), instance, MSG_ROUTING_NONE, NULL); |
| 140 model_->AppendTabContents(tab_contents, true); | 140 model_->AppendTabContents(tab_contents, true); |
| 141 | 141 |
| 142 // Create tab 2. | 142 // Create tab 2. |
| 143 SiteInstance* instance2 = SiteInstance::Create(profile()); | 143 SiteInstance* instance2 = SiteInstance::Create(profile()); |
| 144 TabContents* tab_contents2 = chrome::TabContentsFactory( | 144 TabContents* tab_contents2 = chrome::TabContentsFactory( |
| 145 profile(), instance2, MSG_ROUTING_NONE, NULL, NULL); | 145 profile(), instance2, MSG_ROUTING_NONE, NULL); |
| 146 model_->AppendTabContents(tab_contents2, true); | 146 model_->AppendTabContents(tab_contents2, true); |
| 147 | 147 |
| 148 // Set tab 1 tooltip. | 148 // Set tab 1 tooltip. |
| 149 TabView* tab1 = (TabView*)[controller_.get() viewAtIndex:0]; | 149 TabView* tab1 = (TabView*)[controller_.get() viewAtIndex:0]; |
| 150 [tab1 setToolTip:@"Tab1"]; | 150 [tab1 setToolTip:@"Tab1"]; |
| 151 | 151 |
| 152 // Set tab 2 tooltip. | 152 // Set tab 2 tooltip. |
| 153 TabView* tab2 = (TabView*)[controller_.get() viewAtIndex:1]; | 153 TabView* tab2 = (TabView*)[controller_.get() viewAtIndex:1]; |
| 154 [tab2 setToolTip:@"Tab2"]; | 154 [tab2 setToolTip:@"Tab2"]; |
| 155 | 155 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 [controller_.get() mouseMoved:event]; | 222 [controller_.get() mouseMoved:event]; |
| 223 EXPECT_STREQ("Tab2", | 223 EXPECT_STREQ("Tab2", |
| 224 [[controller_ view:nil | 224 [[controller_ view:nil |
| 225 stringForToolTip:nil | 225 stringForToolTip:nil |
| 226 point:NSMakePoint(0,0) | 226 point:NSMakePoint(0,0) |
| 227 userData:nil] cStringUsingEncoding:NSASCIIStringEncoding]); | 227 userData:nil] cStringUsingEncoding:NSASCIIStringEncoding]); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace | 230 } // namespace |
| OLD | NEW |