OLD | NEW |
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 #include "chrome/browser/tabs/tab_strip_model.h" | 5 #include "chrome/browser/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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); | 149 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); |
150 }; | 150 }; |
151 | 151 |
152 class TabStripModelTest : public ChromeRenderViewHostTestHarness { | 152 class TabStripModelTest : public ChromeRenderViewHostTestHarness { |
153 public: | 153 public: |
154 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) { | 154 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) { |
155 } | 155 } |
156 | 156 |
157 TabContentsWrapper* CreateTabContents() { | 157 TabContentsWrapper* CreateTabContents() { |
158 return Browser::TabContentsFactory(profile(), NULL, 0, NULL, NULL); | 158 return Browser::TabContentsFactory( |
| 159 profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); |
159 } | 160 } |
160 | 161 |
161 TabContentsWrapper* CreateTabContentsWithSharedRPH( | 162 TabContentsWrapper* CreateTabContentsWithSharedRPH( |
162 WebContents* web_contents) { | 163 WebContents* web_contents) { |
163 TabContentsWrapper* retval = Browser::TabContentsFactory(profile(), | 164 TabContentsWrapper* retval = Browser::TabContentsFactory(profile(), |
164 web_contents->GetRenderViewHost()->site_instance(), MSG_ROUTING_NONE, | 165 web_contents->GetRenderViewHost()->site_instance(), MSG_ROUTING_NONE, |
165 NULL, NULL); | 166 NULL, NULL); |
166 EXPECT_EQ(retval->web_contents()->GetRenderProcessHost(), | 167 EXPECT_EQ(retval->web_contents()->GetRenderProcessHost(), |
167 web_contents->GetRenderProcessHost()); | 168 web_contents->GetRenderProcessHost()); |
168 return retval; | 169 return retval; |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 | 1448 |
1448 EXPECT_EQ(1, tabstrip.count()); | 1449 EXPECT_EQ(1, tabstrip.count()); |
1449 | 1450 |
1450 tabstrip.CloseAllTabs(); | 1451 tabstrip.CloseAllTabs(); |
1451 EXPECT_TRUE(tabstrip.empty()); | 1452 EXPECT_TRUE(tabstrip.empty()); |
1452 } | 1453 } |
1453 | 1454 |
1454 // Added for http://b/issue?id=958960 | 1455 // Added for http://b/issue?id=958960 |
1455 TEST_F(TabStripModelTest, AppendContentsReselectionTest) { | 1456 TEST_F(TabStripModelTest, AppendContentsReselectionTest) { |
1456 WebContents* fake_destinations_tab = | 1457 WebContents* fake_destinations_tab = |
1457 WebContents::Create(profile(), NULL, 0, NULL, NULL); | 1458 WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); |
1458 TabContentsWrapper wrapper(fake_destinations_tab); | 1459 TabContentsWrapper wrapper(fake_destinations_tab); |
1459 TabStripDummyDelegate delegate(&wrapper); | 1460 TabStripDummyDelegate delegate(&wrapper); |
1460 TabStripModel tabstrip(&delegate, profile()); | 1461 TabStripModel tabstrip(&delegate, profile()); |
1461 EXPECT_TRUE(tabstrip.empty()); | 1462 EXPECT_TRUE(tabstrip.empty()); |
1462 | 1463 |
1463 // Open the Home Page | 1464 // Open the Home Page |
1464 TabContentsWrapper* homepage_contents = CreateTabContents(); | 1465 TabContentsWrapper* homepage_contents = CreateTabContents(); |
1465 tabstrip.AddTabContents( | 1466 tabstrip.AddTabContents( |
1466 homepage_contents, -1, content::PAGE_TRANSITION_AUTO_BOOKMARK, | 1467 homepage_contents, -1, content::PAGE_TRANSITION_AUTO_BOOKMARK, |
1467 TabStripModel::ADD_ACTIVE); | 1468 TabStripModel::ADD_ACTIVE); |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 ASSERT_EQ(1, observer.GetStateCount()); | 2381 ASSERT_EQ(1, observer.GetStateCount()); |
2381 MockTabStripModelObserver::State s( | 2382 MockTabStripModelObserver::State s( |
2382 contents2, 1, MockTabStripModelObserver::SELECT); | 2383 contents2, 1, MockTabStripModelObserver::SELECT); |
2383 s.src_contents = contents2; | 2384 s.src_contents = contents2; |
2384 s.src_index = 1; | 2385 s.src_index = 1; |
2385 s.user_gesture = false; | 2386 s.user_gesture = false; |
2386 EXPECT_TRUE(observer.StateEquals(0, s)); | 2387 EXPECT_TRUE(observer.StateEquals(0, s)); |
2387 strip.RemoveObserver(&observer); | 2388 strip.RemoveObserver(&observer); |
2388 strip.CloseAllTabs(); | 2389 strip.CloseAllTabs(); |
2389 } | 2390 } |
OLD | NEW |