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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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) 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 #import "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
11 #import "chrome/browser/ui/cocoa/new_tab_button.h" 12 #import "chrome/browser/ui/cocoa/new_tab_button.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 13 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 15 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
15 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 16 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents.h"
17 #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" 18 #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h"
18 #include "content/public/browser/site_instance.h" 19 #include "content/public/browser/site_instance.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 scoped_nsobject<TestTabStripControllerDelegate> controller_delegate_; 112 scoped_nsobject<TestTabStripControllerDelegate> controller_delegate_;
112 scoped_nsobject<TabStripController> controller_; 113 scoped_nsobject<TabStripController> controller_;
113 scoped_nsobject<TabStripView> tab_strip_; 114 scoped_nsobject<TabStripView> tab_strip_;
114 }; 115 };
115 116
116 // Test adding and removing tabs and making sure that views get added to 117 // Test adding and removing tabs and making sure that views get added to
117 // the tab strip. 118 // the tab strip.
118 TEST_F(TabStripControllerTest, AddRemoveTabs) { 119 TEST_F(TabStripControllerTest, AddRemoveTabs) {
119 EXPECT_TRUE(model_->empty()); 120 EXPECT_TRUE(model_->empty());
120 SiteInstance* instance = SiteInstance::Create(profile()); 121 SiteInstance* instance = SiteInstance::Create(profile());
121 TabContents* tab_contents = 122 TabContents* tab_contents = chrome::TabContentsFactory(
122 Browser::TabContentsFactory(profile(), instance, 123 profile(), instance, MSG_ROUTING_NONE, NULL, NULL);
123 MSG_ROUTING_NONE, NULL, NULL);
124 model_->AppendTabContents(tab_contents, true); 124 model_->AppendTabContents(tab_contents, true);
125 EXPECT_EQ(model_->count(), 1); 125 EXPECT_EQ(model_->count(), 1);
126 } 126 }
127 127
128 TEST_F(TabStripControllerTest, SelectTab) { 128 TEST_F(TabStripControllerTest, SelectTab) {
129 // TODO(pinkerton): Implement http://crbug.com/10899 129 // TODO(pinkerton): Implement http://crbug.com/10899
130 } 130 }
131 131
132 TEST_F(TabStripControllerTest, RearrangeTabs) { 132 TEST_F(TabStripControllerTest, RearrangeTabs) {
133 // TODO(pinkerton): Implement http://crbug.com/10899 133 // TODO(pinkerton): Implement http://crbug.com/10899
134 } 134 }
135 135
136 TEST_F(TabStripControllerTest, CorrectToolTipText) { 136 TEST_F(TabStripControllerTest, CorrectToolTipText) {
137 // Create tab 1. 137 // Create tab 1.
138 SiteInstance* instance = SiteInstance::Create(profile()); 138 SiteInstance* instance = SiteInstance::Create(profile());
139 TabContents* tab_contents = 139 TabContents* tab_contents = chrome::TabContentsFactory(
140 Browser::TabContentsFactory(profile(), instance, 140 profile(), instance, MSG_ROUTING_NONE, NULL, NULL);
141 MSG_ROUTING_NONE, NULL, NULL);
142 model_->AppendTabContents(tab_contents, true); 141 model_->AppendTabContents(tab_contents, true);
143 142
144 // Create tab 2. 143 // Create tab 2.
145 SiteInstance* instance2 = SiteInstance::Create(profile()); 144 SiteInstance* instance2 = SiteInstance::Create(profile());
146 TabContents* tab_contents2 = 145 TabContents* tab_contents2 = chrome::TabContentsFactory(
147 Browser::TabContentsFactory(profile(), instance2, 146 profile(), instance2, MSG_ROUTING_NONE, NULL, NULL);
148 MSG_ROUTING_NONE, NULL, NULL);
149 model_->AppendTabContents(tab_contents2, true); 147 model_->AppendTabContents(tab_contents2, true);
150 148
151 // Set tab 1 tooltip. 149 // Set tab 1 tooltip.
152 TabView* tab1 = (TabView*)[controller_.get() viewAtIndex:0]; 150 TabView* tab1 = (TabView*)[controller_.get() viewAtIndex:0];
153 [tab1 setToolTip:@"Tab1"]; 151 [tab1 setToolTip:@"Tab1"];
154 152
155 // Set tab 2 tooltip. 153 // Set tab 2 tooltip.
156 TabView* tab2 = (TabView*)[controller_.get() viewAtIndex:1]; 154 TabView* tab2 = (TabView*)[controller_.get() viewAtIndex:1];
157 [tab2 setToolTip:@"Tab2"]; 155 [tab2 setToolTip:@"Tab2"];
158 156
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 222
225 [controller_.get() mouseMoved:event]; 223 [controller_.get() mouseMoved:event];
226 EXPECT_STREQ("Tab2", 224 EXPECT_STREQ("Tab2",
227 [[controller_ view:nil 225 [[controller_ view:nil
228 stringForToolTip:nil 226 stringForToolTip:nil
229 point:NSMakePoint(0,0) 227 point:NSMakePoint(0,0)
230 userData:nil] cStringUsingEncoding:NSASCIIStringEncoding]); 228 userData:nil] cStringUsingEncoding:NSASCIIStringEncoding]);
231 } 229 }
232 230
233 } // namespace 231 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698