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

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

Issue 9146028: Define the public interface for content browser SiteInstance. This interface is implemented by th... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
11 #import "chrome/browser/ui/cocoa/new_tab_button.h" 11 #import "chrome/browser/ui/cocoa/new_tab_button.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
14 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 14 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
15 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 15 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "content/browser/site_instance.h" 17 #include "content/public/browser/site_instance.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "testing/platform_test.h" 20 #include "testing/platform_test.h"
21 21
22 using content::WebContents; 22 using content::WebContents;
23 23
24 @interface TestTabStripControllerDelegate 24 @interface TestTabStripControllerDelegate
25 : NSObject<TabStripControllerDelegate> { 25 : NSObject<TabStripControllerDelegate> {
26 } 26 }
27 @end 27 @end
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 virtual int GetDragActions() const { 76 virtual int GetDragActions() const {
77 return 0; 77 return 0;
78 } 78 }
79 virtual TabContentsWrapper* CreateTabContentsForURL( 79 virtual TabContentsWrapper* CreateTabContentsForURL(
80 const GURL& url, 80 const GURL& url,
81 const content::Referrer& referrer, 81 const content::Referrer& referrer,
82 Profile* profile, 82 Profile* profile,
83 content::PageTransition transition, 83 content::PageTransition transition,
84 bool defer_load, 84 bool defer_load,
85 SiteInstance* instance) const { 85 content::SiteInstance* instance) const {
86 return NULL; 86 return NULL;
87 } 87 }
88 virtual bool CanDuplicateContentsAt(int index) { return true; } 88 virtual bool CanDuplicateContentsAt(int index) { return true; }
89 virtual void DuplicateContentsAt(int index) { } 89 virtual void DuplicateContentsAt(int index) { }
90 virtual void CloseFrameAfterDragSession() { } 90 virtual void CloseFrameAfterDragSession() { }
91 virtual void CreateHistoricalTab(TabContentsWrapper* contents) { } 91 virtual void CreateHistoricalTab(TabContentsWrapper* contents) { }
92 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents) { 92 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents) {
93 return true; 93 return true;
94 } 94 }
95 virtual bool CanRestoreTab() { 95 virtual bool CanRestoreTab() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 TabStripModel* model_; 161 TabStripModel* model_;
162 scoped_nsobject<TestTabStripControllerDelegate> controller_delegate_; 162 scoped_nsobject<TestTabStripControllerDelegate> controller_delegate_;
163 scoped_nsobject<TabStripController> controller_; 163 scoped_nsobject<TabStripController> controller_;
164 scoped_nsobject<TabStripView> tab_strip_; 164 scoped_nsobject<TabStripView> tab_strip_;
165 }; 165 };
166 166
167 // Test adding and removing tabs and making sure that views get added to 167 // Test adding and removing tabs and making sure that views get added to
168 // the tab strip. 168 // the tab strip.
169 TEST_F(TabStripControllerTest, AddRemoveTabs) { 169 TEST_F(TabStripControllerTest, AddRemoveTabs) {
170 EXPECT_TRUE(model_->empty()); 170 EXPECT_TRUE(model_->empty());
171 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile()); 171 content::SiteInstance* instance =
172 content::SiteInstance::CreateSiteInstance(profile());
172 TabContentsWrapper* tab_contents = 173 TabContentsWrapper* tab_contents =
173 Browser::TabContentsFactory(profile(), instance, 174 Browser::TabContentsFactory(profile(), instance,
174 MSG_ROUTING_NONE, NULL, NULL); 175 MSG_ROUTING_NONE, NULL, NULL);
175 model_->AppendTabContents(tab_contents, true); 176 model_->AppendTabContents(tab_contents, true);
176 EXPECT_EQ(model_->count(), 1); 177 EXPECT_EQ(model_->count(), 1);
177 } 178 }
178 179
179 TEST_F(TabStripControllerTest, SelectTab) { 180 TEST_F(TabStripControllerTest, SelectTab) {
180 // TODO(pinkerton): Implement http://crbug.com/10899 181 // TODO(pinkerton): Implement http://crbug.com/10899
181 } 182 }
182 183
183 TEST_F(TabStripControllerTest, RearrangeTabs) { 184 TEST_F(TabStripControllerTest, RearrangeTabs) {
184 // TODO(pinkerton): Implement http://crbug.com/10899 185 // TODO(pinkerton): Implement http://crbug.com/10899
185 } 186 }
186 187
187 // Test that changing the number of tabs broadcasts a 188 // Test that changing the number of tabs broadcasts a
188 // kTabStripNumberOfTabsChanged notifiction. 189 // kTabStripNumberOfTabsChanged notifiction.
189 TEST_F(TabStripControllerTest, Notifications) { 190 TEST_F(TabStripControllerTest, Notifications) {
190 // TODO(pinkerton): Implement http://crbug.com/10899 191 // TODO(pinkerton): Implement http://crbug.com/10899
191 } 192 }
192 193
193 TEST_F(TabStripControllerTest, CorrectToolTipText) { 194 TEST_F(TabStripControllerTest, CorrectToolTipText) {
194 // Create tab 1. 195 // Create tab 1.
195 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile()); 196 content::SiteInstance* instance =
197 content::SiteInstance::CreateSiteInstance(profile());
196 TabContentsWrapper* tab_contents = 198 TabContentsWrapper* tab_contents =
197 Browser::TabContentsFactory(profile(), instance, 199 Browser::TabContentsFactory(profile(), instance,
198 MSG_ROUTING_NONE, NULL, NULL); 200 MSG_ROUTING_NONE, NULL, NULL);
199 model_->AppendTabContents(tab_contents, true); 201 model_->AppendTabContents(tab_contents, true);
200 202
201 // Create tab 2. 203 // Create tab 2.
202 SiteInstance* instance2 = SiteInstance::CreateSiteInstance(profile()); 204 content::SiteInstance* instance2 =
205 content::SiteInstance::CreateSiteInstance(profile());
203 TabContentsWrapper* tab_contents2 = 206 TabContentsWrapper* tab_contents2 =
204 Browser::TabContentsFactory(profile(), instance2, 207 Browser::TabContentsFactory(profile(), instance2,
205 MSG_ROUTING_NONE, NULL, NULL); 208 MSG_ROUTING_NONE, NULL, NULL);
206 model_->AppendTabContents(tab_contents2, true); 209 model_->AppendTabContents(tab_contents2, true);
207 210
208 // Set tab 1 tooltip. 211 // Set tab 1 tooltip.
209 TabView* tab1 = (TabView*)[controller_.get() viewAtIndex:0]; 212 TabView* tab1 = (TabView*)[controller_.get() viewAtIndex:0];
210 [tab1 setToolTip:@"Tab1"]; 213 [tab1 setToolTip:@"Tab1"];
211 214
212 // Set tab 2 tooltip. 215 // Set tab 2 tooltip.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 284
282 [controller_.get() mouseMoved:event]; 285 [controller_.get() mouseMoved:event];
283 EXPECT_STREQ("Tab2", 286 EXPECT_STREQ("Tab2",
284 [[controller_ view:nil 287 [[controller_ view:nil
285 stringForToolTip:nil 288 stringForToolTip:nil
286 point:NSMakePoint(0,0) 289 point:NSMakePoint(0,0)
287 userData:nil] cStringUsingEncoding:NSASCIIStringEncoding]); 290 userData:nil] cStringUsingEncoding:NSASCIIStringEncoding]);
288 } 291 }
289 292
290 } // namespace 293 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698