| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "chrome/browser/dock_info.h" | 7 #include "chrome/browser/dock_info.h" |
| 8 #include "chrome/browser/dom_ui/new_tab_ui.h" | 8 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/browser/profile_manager.h" | 10 #include "chrome/browser/profile_manager.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 s->src_index = from_index; | 267 s->src_index = from_index; |
| 268 states_.push_back(s); | 268 states_.push_back(s); |
| 269 } | 269 } |
| 270 | 270 |
| 271 virtual void TabClosingAt(TabContents* contents, int index) { | 271 virtual void TabClosingAt(TabContents* contents, int index) { |
| 272 states_.push_back(new State(contents, index, CLOSE)); | 272 states_.push_back(new State(contents, index, CLOSE)); |
| 273 } | 273 } |
| 274 virtual void TabDetachedAt(TabContents* contents, int index) { | 274 virtual void TabDetachedAt(TabContents* contents, int index) { |
| 275 states_.push_back(new State(contents, index, DETACH)); | 275 states_.push_back(new State(contents, index, DETACH)); |
| 276 } | 276 } |
| 277 virtual void TabChangedAt(TabContents* contents, int index) { | 277 virtual void TabChangedAt(TabContents* contents, int index, |
| 278 bool loading_only) { |
| 278 states_.push_back(new State(contents, index, CHANGE)); | 279 states_.push_back(new State(contents, index, CHANGE)); |
| 279 } | 280 } |
| 280 virtual void TabStripEmpty() { | 281 virtual void TabStripEmpty() { |
| 281 empty_ = true; | 282 empty_ = true; |
| 282 } | 283 } |
| 283 | 284 |
| 284 void ClearStates() { | 285 void ClearStates() { |
| 285 STLDeleteContainerPointers(states_.begin(), states_.end()); | 286 STLDeleteContainerPointers(states_.begin(), states_.end()); |
| 286 states_.clear(); | 287 states_.clear(); |
| 287 } | 288 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 EXPECT_EQ(contents1, tabstrip.GetTabContentsAt(1)); | 459 EXPECT_EQ(contents1, tabstrip.GetTabContentsAt(1)); |
| 459 EXPECT_EQ(0, tabstrip.GetIndexOfTabContents(replacement_contents2)); | 460 EXPECT_EQ(0, tabstrip.GetIndexOfTabContents(replacement_contents2)); |
| 460 EXPECT_EQ(1, tabstrip.GetIndexOfTabContents(contents1)); | 461 EXPECT_EQ(1, tabstrip.GetIndexOfTabContents(contents1)); |
| 461 EXPECT_EQ(0, tabstrip.GetIndexOfController( | 462 EXPECT_EQ(0, tabstrip.GetIndexOfController( |
| 462 replacement_contents2->controller())); | 463 replacement_contents2->controller())); |
| 463 EXPECT_EQ(1, tabstrip.GetIndexOfController(contents1->controller())); | 464 EXPECT_EQ(1, tabstrip.GetIndexOfController(contents1->controller())); |
| 464 } | 465 } |
| 465 | 466 |
| 466 // Test UpdateTabContentsStateAt | 467 // Test UpdateTabContentsStateAt |
| 467 { | 468 { |
| 468 tabstrip.UpdateTabContentsStateAt(0); | 469 tabstrip.UpdateTabContentsStateAt(0, false); |
| 469 EXPECT_EQ(1, observer.GetStateCount()); | 470 EXPECT_EQ(1, observer.GetStateCount()); |
| 470 State s1(replacement_contents2, 0, MockTabStripModelObserver::CHANGE); | 471 State s1(replacement_contents2, 0, MockTabStripModelObserver::CHANGE); |
| 471 EXPECT_TRUE(observer.StateEquals(0, s1)); | 472 EXPECT_TRUE(observer.StateEquals(0, s1)); |
| 472 observer.ClearStates(); | 473 observer.ClearStates(); |
| 473 } | 474 } |
| 474 | 475 |
| 475 // Test SelectNextTab, SelectPreviousTab, SelectLastTab | 476 // Test SelectNextTab, SelectPreviousTab, SelectLastTab |
| 476 { | 477 { |
| 477 // Make sure the second of the two tabs is selected first... | 478 // Make sure the second of the two tabs is selected first... |
| 478 tabstrip.SelectTabContentsAt(1, true); | 479 tabstrip.SelectTabContentsAt(1, true); |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 | 1288 |
| 1288 // Now select the last tab. | 1289 // Now select the last tab. |
| 1289 strip.SelectTabContentsAt(strip.count() - 1, true); | 1290 strip.SelectTabContentsAt(strip.count() - 1, true); |
| 1290 | 1291 |
| 1291 // Now close the last tab. The next adjacent should be selected. | 1292 // Now close the last tab. The next adjacent should be selected. |
| 1292 strip.CloseTabContentsAt(strip.count() - 1); | 1293 strip.CloseTabContentsAt(strip.count() - 1); |
| 1293 EXPECT_EQ(page_d_contents, strip.GetTabContentsAt(strip.selected_index())); | 1294 EXPECT_EQ(page_d_contents, strip.GetTabContentsAt(strip.selected_index())); |
| 1294 | 1295 |
| 1295 strip.CloseAllTabs(); | 1296 strip.CloseAllTabs(); |
| 1296 } | 1297 } |
| OLD | NEW |