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

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model_unittest.cc

Issue 10831116: Move SessionStorageNamespace entirely into NavigationController and support StoragePartitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac win compile fixes Created 8 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 | 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 #include "chrome/browser/ui/tabs/tab_strip_model.h" 5 #include "chrome/browser/ui/tabs/tab_strip_model.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); 117 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate);
118 }; 118 };
119 119
120 class TabStripModelTest : public ChromeRenderViewHostTestHarness { 120 class TabStripModelTest : public ChromeRenderViewHostTestHarness {
121 public: 121 public:
122 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) { 122 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) {
123 } 123 }
124 124
125 TabContents* CreateTabContents() { 125 TabContents* CreateTabContents() {
126 return chrome::TabContentsFactory( 126 return chrome::TabContentsFactory(profile(), NULL, MSG_ROUTING_NONE, NULL);
127 profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
128 } 127 }
129 128
130 TabContents* CreateTabContentsWithSharedRPH( 129 TabContents* CreateTabContentsWithSharedRPH(
131 WebContents* web_contents) { 130 WebContents* web_contents) {
132 TabContents* retval = chrome::TabContentsFactory(profile(), 131 TabContents* retval = chrome::TabContentsFactory(profile(),
133 web_contents->GetRenderViewHost()->GetSiteInstance(), MSG_ROUTING_NONE, 132 web_contents->GetRenderViewHost()->GetSiteInstance(), MSG_ROUTING_NONE,
134 NULL, NULL); 133 NULL);
135 EXPECT_EQ(retval->web_contents()->GetRenderProcessHost(), 134 EXPECT_EQ(retval->web_contents()->GetRenderProcessHost(),
136 web_contents->GetRenderProcessHost()); 135 web_contents->GetRenderProcessHost());
137 return retval; 136 return retval;
138 } 137 }
139 138
140 // Forwards a URL "load" request through to our dummy TabContents 139 // Forwards a URL "load" request through to our dummy TabContents
141 // implementation. 140 // implementation.
142 void LoadURL(WebContents* con, const std::wstring& url) { 141 void LoadURL(WebContents* con, const std::wstring& url) {
143 controller().LoadURL(GURL(WideToUTF16(url)), content::Referrer(), 142 controller().LoadURL(GURL(WideToUTF16(url)), content::Referrer(),
144 content::PAGE_TRANSITION_LINK, std::string()); 143 content::PAGE_TRANSITION_LINK, std::string());
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 1443
1445 EXPECT_EQ(1, tabstrip.count()); 1444 EXPECT_EQ(1, tabstrip.count());
1446 1445
1447 tabstrip.CloseAllTabs(); 1446 tabstrip.CloseAllTabs();
1448 EXPECT_TRUE(tabstrip.empty()); 1447 EXPECT_TRUE(tabstrip.empty());
1449 } 1448 }
1450 1449
1451 // Added for http://b/issue?id=958960 1450 // Added for http://b/issue?id=958960
1452 TEST_F(TabStripModelTest, AppendContentsReselectionTest) { 1451 TEST_F(TabStripModelTest, AppendContentsReselectionTest) {
1453 WebContents* fake_destinations_tab = 1452 WebContents* fake_destinations_tab =
1454 WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); 1453 WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL);
1455 TabContents tab_contents(fake_destinations_tab); 1454 TabContents tab_contents(fake_destinations_tab);
1456 TabStripDummyDelegate delegate(&tab_contents); 1455 TabStripDummyDelegate delegate(&tab_contents);
1457 TabStripModel tabstrip(&delegate, profile()); 1456 TabStripModel tabstrip(&delegate, profile());
1458 EXPECT_TRUE(tabstrip.empty()); 1457 EXPECT_TRUE(tabstrip.empty());
1459 1458
1460 // Open the Home Page 1459 // Open the Home Page
1461 TabContents* homepage_contents = CreateTabContents(); 1460 TabContents* homepage_contents = CreateTabContents();
1462 tabstrip.AddTabContents( 1461 tabstrip.AddTabContents(
1463 homepage_contents, -1, content::PAGE_TRANSITION_AUTO_BOOKMARK, 1462 homepage_contents, -1, content::PAGE_TRANSITION_AUTO_BOOKMARK,
1464 TabStripModel::ADD_ACTIVE); 1463 TabStripModel::ADD_ACTIVE);
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 ASSERT_EQ(1, observer.GetStateCount()); 2412 ASSERT_EQ(1, observer.GetStateCount());
2414 MockTabStripModelObserver::State s( 2413 MockTabStripModelObserver::State s(
2415 contents2, 1, MockTabStripModelObserver::SELECT); 2414 contents2, 1, MockTabStripModelObserver::SELECT);
2416 s.src_contents = contents2; 2415 s.src_contents = contents2;
2417 s.src_index = 1; 2416 s.src_index = 1;
2418 s.user_gesture = false; 2417 s.user_gesture = false;
2419 EXPECT_TRUE(observer.StateEquals(0, s)); 2418 EXPECT_TRUE(observer.StateEquals(0, s));
2420 strip.RemoveObserver(&observer); 2419 strip.RemoveObserver(&observer);
2421 strip.CloseAllTabs(); 2420 strip.CloseAllTabs();
2422 } 2421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698