summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tabs
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 17:44:44 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 17:44:44 +0000
commit1ea49d5727a9e6ba1375030c5e38b992ca4015e8 (patch)
tree0e6e49879c0ec583c6a3da445bfd0a1ba370e674 /chrome/browser/tabs
parenta34f012a19f0915ba5ebc9ba8049763651839515 (diff)
downloadchromium_src-1ea49d5727a9e6ba1375030c5e38b992ca4015e8.zip
chromium_src-1ea49d5727a9e6ba1375030c5e38b992ca4015e8.tar.gz
chromium_src-1ea49d5727a9e6ba1375030c5e38b992ca4015e8.tar.bz2
Renames TabStripModel and Browser's selected_index to
active_index. I plan on renaming more, but wanted to start with this one. BUG=none TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/6823064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81268 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc56
-rw-r--r--chrome/browser/tabs/tab_strip_model.h6
-rw-r--r--chrome/browser/tabs/tab_strip_model_observer.h17
-rw-r--r--chrome/browser/tabs/tab_strip_model_order_controller.cc14
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc82
5 files changed, 86 insertions, 89 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 7e31c30..c4d1aa1 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -177,13 +177,13 @@ TabContentsWrapper* TabStripModel::ReplaceTabContentsAt(
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
TabReplacedAt(this, old_contents, new_contents, index));
- // When the selected tab contents is replaced send out selected notification
+ // When the active tab contents is replaced send out selected notification
// too. We do this as nearly all observers need to treat a replace of the
// selected contents as selection changing.
- if (selected_index() == index) {
+ if (active_index() == index) {
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabSelectedAt(old_contents, new_contents,
- selected_index(), false));
+ TabSelectedAt(old_contents, new_contents, active_index(),
+ false));
}
return old_contents;
}
@@ -221,17 +221,17 @@ TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) {
// a second pass.
FOR_EACH_OBSERVER(TabStripModelObserver, observers_, TabStripEmpty());
} else {
- int old_selected = selected_index();
+ int old_active = active_index();
selection_model_.DecrementFrom(index);
- if (index == old_selected) {
+ if (index == old_active) {
if (!selection_model_.empty()) {
// A selected tab was removed, but there is still something selected.
// Move the active and anchor to the first selected index.
selection_model_.set_active(selection_model_.selected_indices()[0]);
selection_model_.set_anchor(selection_model_.active());
- NotifyTabSelectedIfChanged(removed_contents, selected_index(), false);
+ NotifyTabSelectedIfChanged(removed_contents, active_index(), false);
} else {
- // The selected tab was removed and nothing is selected. Reset the
+ // The active tab was removed and nothing is selected. Reset the
// selection and send out notification.
selection_model_.SetSelectedIndex(next_selected_index);
NotifyTabSelectedIfChanged(removed_contents, next_selected_index,
@@ -246,7 +246,7 @@ void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) {
DCHECK(ContainsIndex(index));
bool had_multi = selection_model_.selected_indices().size() > 1;
TabContentsWrapper* old_contents =
- (selected_index() == TabStripSelectionModel::kUnselectedIndex) ?
+ (active_index() == TabStripSelectionModel::kUnselectedIndex) ?
NULL : GetSelectedTabContents();
selection_model_.SetSelectedIndex(index);
TabContentsWrapper* new_contents = GetContentsAt(index);
@@ -257,7 +257,7 @@ void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) {
if (old_contents != new_contents || had_multi) {
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
TabSelectedAt(old_contents, new_contents,
- selected_index(), user_gesture));
+ active_index(), user_gesture));
}
}
@@ -313,7 +313,7 @@ void TabStripModel::MoveSelectedTabsTo(int index) {
}
TabContentsWrapper* TabStripModel::GetSelectedTabContents() const {
- return GetTabContentsAt(selected_index());
+ return GetTabContentsAt(active_index());
}
TabContentsWrapper* TabStripModel::GetTabContentsAt(int index) const {
@@ -570,15 +570,15 @@ int TabStripModel::ConstrainInsertionIndex(int index, bool mini_tab) {
void TabStripModel::ExtendSelectionTo(int index) {
DCHECK(ContainsIndex(index));
- int old_selection = selected_index();
+ int old_active = active_index();
selection_model_.SetSelectionFromAnchorTo(index);
// This may not have resulted in a change, but we assume it did.
- NotifySelectionChanged(old_selection);
+ NotifySelectionChanged(old_active);
}
void TabStripModel::ToggleSelectionAt(int index) {
DCHECK(ContainsIndex(index));
- int old_selection = selected_index();
+ int old_active = active_index();
if (selection_model_.IsSelected(index)) {
if (selection_model_.size() == 1) {
// One tab must be selected and this tab is currently selected so we can't
@@ -594,13 +594,13 @@ void TabStripModel::ToggleSelectionAt(int index) {
selection_model_.set_anchor(index);
selection_model_.set_active(index);
}
- NotifySelectionChanged(old_selection);
+ NotifySelectionChanged(old_active);
}
void TabStripModel::AddSelectionFromAnchorTo(int index) {
- int old_selection = selected_index();
+ int old_active = active_index();
selection_model_.AddSelectionFromAnchorTo(index);
- NotifySelectionChanged(old_selection);
+ NotifySelectionChanged(old_active);
}
bool TabStripModel::IsTabSelected(int index) const {
@@ -611,10 +611,10 @@ bool TabStripModel::IsTabSelected(int index) const {
void TabStripModel::SetSelectionFromModel(
const TabStripSelectionModel& source) {
DCHECK_NE(TabStripSelectionModel::kUnselectedIndex, source.active());
- int old_selected_index = selected_index();
+ int old_active_index = active_index();
selection_model_.Copy(source);
// This may not have resulted in a change, but we assume it did.
- NotifySelectionChanged(old_selected_index);
+ NotifySelectionChanged(old_active_index);
}
void TabStripModel::AddTabContents(TabContentsWrapper* contents,
@@ -703,14 +703,14 @@ void TabStripModel::SelectLastTab() {
void TabStripModel::MoveTabNext() {
// TODO: this likely needs to be updated for multi-selection.
- int new_index = std::min(selected_index() + 1, count() - 1);
- MoveTabContentsAt(selected_index(), new_index, true);
+ int new_index = std::min(active_index() + 1, count() - 1);
+ MoveTabContentsAt(active_index(), new_index, true);
}
void TabStripModel::MoveTabPrevious() {
// TODO: this likely needs to be updated for multi-selection.
- int new_index = std::max(selected_index() - 1, 0);
- MoveTabContentsAt(selected_index(), new_index, true);
+ int new_index = std::max(active_index() - 1, 0);
+ MoveTabContentsAt(active_index(), new_index, true);
}
// Context menu functions.
@@ -1222,7 +1222,7 @@ void TabStripModel::NotifyTabSelectedIfChanged(TabContentsWrapper* old_contents,
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
TabSelectedAt(last_selected_contents, new_contents,
- selected_index(), user_gesture));
+ active_index(), user_gesture));
}
void TabStripModel::NotifySelectionChanged(int old_selected_index) {
@@ -1230,10 +1230,10 @@ void TabStripModel::NotifySelectionChanged(int old_selected_index) {
old_selected_index == TabStripSelectionModel::kUnselectedIndex ?
NULL : GetTabContentsAt(old_selected_index);
TabContentsWrapper* new_tab =
- selected_index() == TabStripSelectionModel::kUnselectedIndex ?
- NULL : GetTabContentsAt(selected_index());
+ active_index() == TabStripSelectionModel::kUnselectedIndex ?
+ NULL : GetTabContentsAt(active_index());
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabSelectedAt(old_tab, new_tab, selected_index(), true));
+ TabSelectedAt(old_tab, new_tab, active_index(), true));
}
void TabStripModel::SelectRelativeTab(bool next) {
@@ -1242,7 +1242,7 @@ void TabStripModel::SelectRelativeTab(bool next) {
if (contents_data_.empty())
return;
- int index = selected_index();
+ int index = active_index();
int delta = next ? 1 : -1;
index = (index + count() + delta) % count();
SelectTabContentsAt(index, true);
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 42489b4..ed15ffb 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -132,10 +132,8 @@ class TabStripModel : public NotificationObserver {
// Retrieve the Profile associated with this TabStripModel.
Profile* profile() const { return profile_; }
- // Retrieve the index of the currently selected TabContents.
- // TODO(sky): rename this to active and update similar places (observer,
- // other methods...).
- int selected_index() const { return selection_model_.active(); }
+ // Retrieve the index of the currently active TabContents.
+ int active_index() const { return selection_model_.active(); }
// Returns true if the tabstrip is currently closing all open tabs (via a
// call to CloseAllTabs). As tabs close, the selection in the tabstrip
diff --git a/chrome/browser/tabs/tab_strip_model_observer.h b/chrome/browser/tabs/tab_strip_model_observer.h
index 055718e..5757d88 100644
--- a/chrome/browser/tabs/tab_strip_model_observer.h
+++ b/chrome/browser/tabs/tab_strip_model_observer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -64,14 +64,13 @@ class TabStripModelObserver {
// Sent when the selection changes. The previously selected tab is identified
// by |old_contents| and the newly selected tab by |new_contents|. |index| is
// the index of |new_contents|. When using multiple selection this may be sent
- // even when the selected tab (as returned by selected_index()) has not
- // changed. For example, if the selection is extended this method is invoked
- // to inform observers the selection has changed, but |old_contents| and
- // |new_contents| are the same. If you only care about when the selected tab
- // changes, check for when |old_contents| differs from
- // |new_contents|. |user_gesture| specifies whether or not this was done by a
- // user input event (e.g. clicking on a tab, keystroke) or as a side-effect of
- // some other function.
+ // even when the active tab has not changed. For example, if the selection is
+ // extended this method is invoked to inform observers the selection has
+ // changed, but |old_contents| and |new_contents| are the same. If you only
+ // care about when the active tab changes, check for when |old_contents|
+ // differs from |new_contents|. |user_gesture| specifies whether or not this
+ // was done by a user input event (e.g. clicking on a tab, keystroke) or as a
+ // side-effect of some other function.
//
// TODO(sky): consider not overloading this. Instead rename this to
// TabActivatedAt (or something) and have TabSelectionChanged as well.
diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc
index cc3eaec..8c8f4db 100644
--- a/chrome/browser/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,12 +30,12 @@ int TabStripModelOrderController::DetermineInsertionIndex(
// NOTE: TabStripModel enforces that all non-mini-tabs occur after mini-tabs,
// so we don't have to check here too.
- if (transition == PageTransition::LINK && tabstrip_->selected_index() != -1) {
+ if (transition == PageTransition::LINK && tabstrip_->active_index() != -1) {
int delta = (insertion_policy_ == TabStripModel::INSERT_AFTER) ? 1 : 0;
if (foreground) {
// If the page was opened in the foreground by a link click in another
// tab, insert it adjacent to the tab that opened that link.
- return tabstrip_->selected_index() + delta;
+ return tabstrip_->active_index() + delta;
}
NavigationController* opener =
&tabstrip_->GetSelectedTabContents()->controller();
@@ -44,15 +44,15 @@ int TabStripModelOrderController::DetermineInsertionIndex(
int index;
if (insertion_policy_ == TabStripModel::INSERT_AFTER) {
index = tabstrip_->GetIndexOfLastTabContentsOpenedBy(
- opener, tabstrip_->selected_index());
+ opener, tabstrip_->active_index());
} else {
index = tabstrip_->GetIndexOfFirstTabContentsOpenedBy(
- opener, tabstrip_->selected_index());
+ opener, tabstrip_->active_index());
}
if (index != TabStripModel::kNoTab)
return index + delta;
// Otherwise insert adjacent to opener...
- return tabstrip_->selected_index() + delta;
+ return tabstrip_->active_index() + delta;
}
// In other cases, such as Ctrl+T, open at the end of the strip.
return DetermineInsertionIndexForAppending();
@@ -99,7 +99,7 @@ int TabStripModelOrderController::DetermineNewSelectedIndex(
}
// No opener set, fall through to the default handler...
- int selected_index = tabstrip_->selected_index();
+ int selected_index = tabstrip_->active_index();
if (selected_index >= (tab_count - 1))
return selected_index - 1;
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 993f409..f1d39b1 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -524,7 +524,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
State s1(contents2, 0, MockTabStripModelObserver::MOVE);
s1.src_index = 1;
EXPECT_TRUE(observer.StateEquals(0, s1));
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
observer.ClearStates();
}
@@ -535,7 +535,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
State s1(contents1, 0, MockTabStripModelObserver::MOVE);
s1.src_index = 1;
EXPECT_TRUE(observer.StateEquals(0, s1));
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.MoveTabContentsAt(0, 1, false);
observer.ClearStates();
@@ -566,11 +566,11 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// Make sure the second of the two tabs is selected first...
tabstrip.SelectTabContentsAt(1, true);
tabstrip.SelectPreviousTab();
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.SelectLastTab();
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.SelectNextTab();
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
}
// Test CloseSelectedTabs
@@ -580,7 +580,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// just verify that the count and selected index have changed
// appropriately...
EXPECT_EQ(1, tabstrip.count());
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
}
tabstrip.CloseAllTabs();
@@ -787,12 +787,12 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) {
tabstrip.InsertTabContentsAt(insert_index, fg_link_contents,
TabStripModel::ADD_SELECTED |
TabStripModel::ADD_INHERIT_GROUP);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
EXPECT_EQ(fg_link_contents, tabstrip.GetSelectedTabContents());
// Now close this contents. The selection should move to the opener contents.
tabstrip.CloseSelectedTabs();
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// Now open a new empty tab. It should open at the end of the strip.
TabContentsWrapper* fg_nonlink_contents = CreateTabContents();
@@ -805,7 +805,7 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) {
// Now select it, so that user_gesture == true causes the opener relationship
// to be forgotten...
tabstrip.SelectTabContentsAt(tabstrip.count() - 1, true);
- EXPECT_EQ(tabstrip.count() - 1, tabstrip.selected_index());
+ EXPECT_EQ(tabstrip.count() - 1, tabstrip.active_index());
EXPECT_EQ(fg_nonlink_contents, tabstrip.GetSelectedTabContents());
// Verify that all opener relationships are forgotten.
@@ -847,10 +847,10 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
// First test that closing tabs that are in the background doesn't adjust the
// current selection.
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
for (int i = tabstrip.count() - 1; i >= 1; --i)
tabstrip.DetachTabContentsAt(i);
@@ -858,17 +858,17 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
// Now test that when a tab doesn't have an opener, selection shifts to the
// right when the tab is closed.
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.ForgetAllOpeners();
tabstrip.SelectTabContentsAt(1, true);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
for (int i = tabstrip.count() - 1; i >= 1; --i)
tabstrip.DetachTabContentsAt(i);
@@ -876,15 +876,15 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
// Now test that when a tab does have an opener, it selects the next tab
// opened by the same opener scanning LTR when it is closed.
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.SelectTabContentsAt(2, false);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.CloseTabContentsAt(1, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// Finally test that when a tab has no "siblings" that the opener is
// selected.
TabContentsWrapper* other_contents = CreateTabContents();
@@ -894,9 +894,9 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
tabstrip.InsertTabContentsAt(2, opened_contents,
TabStripModel::ADD_SELECTED |
TabStripModel::ADD_INHERIT_GROUP);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.CloseAllTabs();
EXPECT_TRUE(tabstrip.empty());
@@ -1090,7 +1090,7 @@ TEST_F(TabStripModelTest, TestContextMenuCloseCommands) {
TabContentsWrapper* contents3 = CreateTabContents();
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.ExecuteContextMenuCommand(2, TabStripModel::CommandCloseTab);
EXPECT_EQ(3, tabstrip.count());
@@ -1431,15 +1431,15 @@ TEST_F(TabStripModelTest, AppendContentsReselectionTest) {
TabStripModel::ADD_NONE);
// The selected tab should still be the first.
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// Now simulate a link click that opens a new tab (by virtue of target=_blank)
// and make sure the right tab gets selected when the new tab is closed.
TabContentsWrapper* target_blank_contents = CreateTabContents();
tabstrip.AppendTabContents(target_blank_contents, true);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// clean up after ourselves
tabstrip.CloseAllTabs();
@@ -1476,19 +1476,19 @@ TEST_F(TabStripModelTest, ReselectionConsidersChildrenTest) {
EXPECT_EQ(page_a_a_a_contents, strip.GetTabContentsAt(2));
// Close page A.A
- strip.CloseTabContentsAt(strip.selected_index(), TabStripModel::CLOSE_NONE);
+ strip.CloseTabContentsAt(strip.active_index(), TabStripModel::CLOSE_NONE);
// Page A.A.A should be selected, NOT A.B
EXPECT_EQ(page_a_a_a_contents, strip.GetSelectedTabContents());
// Close page A.A.A
- strip.CloseTabContentsAt(strip.selected_index(), TabStripModel::CLOSE_NONE);
+ strip.CloseTabContentsAt(strip.active_index(), TabStripModel::CLOSE_NONE);
// Page A.B should be selected
EXPECT_EQ(page_a_b_contents, strip.GetSelectedTabContents());
// Close page A.B
- strip.CloseTabContentsAt(strip.selected_index(), TabStripModel::CLOSE_NONE);
+ strip.CloseTabContentsAt(strip.active_index(), TabStripModel::CLOSE_NONE);
// Page A should be selected
EXPECT_EQ(page_a_contents, strip.GetSelectedTabContents());
@@ -1526,13 +1526,13 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) {
TabStripModel::ADD_SELECTED);
EXPECT_EQ(4, strip.GetIndexOfTabContents(new_tab_contents));
- EXPECT_EQ(4, strip.selected_index());
+ EXPECT_EQ(4, strip.active_index());
// Close the New Tab that was just opened. We should be returned to page B's
// Tab...
strip.CloseTabContentsAt(4, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(1, strip.selected_index());
+ EXPECT_EQ(1, strip.active_index());
// Open a non-New Tab tab at the end of the strip, with a TYPED transition.
// This is like typing a URL in the address bar and pressing Alt+Enter. The
@@ -1542,12 +1542,12 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) {
TabStripModel::ADD_SELECTED);
EXPECT_EQ(4, strip.GetIndexOfTabContents(page_e_contents));
- EXPECT_EQ(4, strip.selected_index());
+ EXPECT_EQ(4, strip.active_index());
// Close the Tab. Selection should shift back to page B's Tab.
strip.CloseTabContentsAt(4, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(1, strip.selected_index());
+ EXPECT_EQ(1, strip.active_index());
// Open a non-New Tab tab at the end of the strip, with some other
// transition. This is like right clicking on a bookmark and choosing "Open
@@ -1558,12 +1558,12 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) {
TabStripModel::ADD_SELECTED);
EXPECT_EQ(4, strip.GetIndexOfTabContents(page_f_contents));
- EXPECT_EQ(4, strip.selected_index());
+ EXPECT_EQ(4, strip.active_index());
// Close the Tab. The next-adjacent should be selected.
strip.CloseTabContentsAt(4, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(3, strip.selected_index());
+ EXPECT_EQ(3, strip.active_index());
// Clean up.
strip.CloseAllTabs();
@@ -1604,7 +1604,7 @@ TEST_F(TabStripModelTest, NavigationForgetsOpeners) {
// Close page D, page C should be selected. (part of same group).
strip.CloseTabContentsAt(3, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(2, strip.selected_index());
+ EXPECT_EQ(2, strip.active_index());
// Tell the TabStripModel that we are navigating in page C via a bookmark.
strip.TabNavigating(page_c_contents, PageTransition::AUTO_BOOKMARK);
@@ -1612,7 +1612,7 @@ TEST_F(TabStripModelTest, NavigationForgetsOpeners) {
// Close page C, page E should be selected. (C is no longer part of the
// A-B-C-D group, selection moves to the right).
strip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(page_e_contents, strip.GetTabContentsAt(strip.selected_index()));
+ EXPECT_EQ(page_e_contents, strip.GetTabContentsAt(strip.active_index()));
strip.CloseAllTabs();
}
@@ -1655,7 +1655,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) {
// At this point, if we close this tab the last selected one should be
// re-selected.
strip.CloseTabContentsAt(strip.count() - 1, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(page_c_contents, strip.GetTabContentsAt(strip.selected_index()));
+ EXPECT_EQ(page_c_contents, strip.GetTabContentsAt(strip.active_index()));
// TEST 2: If the user is in a group of tabs and opens a new tab at the end
// of the strip, selecting any other tab in the strip will cause that new
@@ -1674,7 +1674,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) {
// Now close the last tab. The next adjacent should be selected.
strip.CloseTabContentsAt(strip.count() - 1, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(page_d_contents, strip.GetTabContentsAt(strip.selected_index()));
+ EXPECT_EQ(page_d_contents, strip.GetTabContentsAt(strip.active_index()));
strip.CloseAllTabs();
}
@@ -2171,7 +2171,7 @@ TEST_F(TabStripModelTest, CloseSelectedTabs) {
strip.ToggleSelectionAt(1);
strip.CloseSelectedTabs();
EXPECT_EQ(1, strip.count());
- EXPECT_EQ(0, strip.selected_index());
+ EXPECT_EQ(0, strip.active_index());
strip.CloseAllTabs();
}