Commit 6d8203f8 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Remove unused method from TabModel

The -openerOfTab: method of the TabModel wasn't used. This CL removes
it.

Bug: none
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I79d219e52798a47da582d373b0b8e277e263a11e
Reviewed-on: https://chromium-review.googlesource.com/1122631Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572147}
parent 426c0fc6
...@@ -105,9 +105,6 @@ NSUInteger const kTabPositionAutomatically = NSNotFound; ...@@ -105,9 +105,6 @@ NSUInteger const kTabPositionAutomatically = NSNotFound;
- (Tab*)tabAtIndex:(NSUInteger)index; - (Tab*)tabAtIndex:(NSUInteger)index;
- (NSUInteger)indexOfTab:(Tab*)tab; - (NSUInteger)indexOfTab:(Tab*)tab;
// Returns the tab which opened this tab, or nil if it's not a child.
- (Tab*)openerOfTab:(Tab*)tab;
// Add/modify tabs. // Add/modify tabs.
// Opens a tab at the specified URL. For certain transition types, will consult // Opens a tab at the specified URL. For certain transition types, will consult
......
...@@ -470,16 +470,6 @@ void RecordMainFrameNavigationMetric(web::WebState* web_state) { ...@@ -470,16 +470,6 @@ void RecordMainFrameNavigationMetric(web::WebState* web_state) {
return static_cast<NSUInteger>(index); return static_cast<NSUInteger>(index);
} }
- (Tab*)openerOfTab:(Tab*)tab {
int index = _webStateList->GetIndexOfWebState(tab.webState);
if (index == WebStateList::kInvalidIndex)
return nil;
WebStateOpener opener = _webStateList->GetOpenerOfWebStateAt(index);
return opener.opener ? LegacyTabHelper::GetTabForWebState(opener.opener)
: nil;
}
- (Tab*)insertTabWithURL:(const GURL&)URL - (Tab*)insertTabWithURL:(const GURL&)URL
referrer:(const web::Referrer&)referrer referrer:(const web::Referrer&)referrer
transition:(ui::PageTransition)transition transition:(ui::PageTransition)transition
......
...@@ -470,76 +470,6 @@ TEST_F(TabModelTest, InsertWithSessionController) { ...@@ -470,76 +470,6 @@ TEST_F(TabModelTest, InsertWithSessionController) {
EXPECT_TRUE(current_tab); EXPECT_TRUE(current_tab);
} }
TEST_F(TabModelTest, OpenerOfTab) {
// Start off with a couple tabs.
[tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:nil
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
[tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:nil
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
[tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:nil
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
// Create parent tab.
Tab* parent_tab = [tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:nil
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
// Create child tab.
Tab* child_tab = [tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:parent_tab
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
// Create another unrelated tab.
Tab* another_tab = [tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:nil
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
// Create another child of the first tab.
Tab* child_tab2 = [tab_model_ insertTabWithURL:GURL(kURL1)
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_TYPED
opener:parent_tab
openedByDOM:NO
atIndex:[tab_model_ count]
inBackground:NO];
EXPECT_FALSE([tab_model_ openerOfTab:parent_tab]);
EXPECT_FALSE([tab_model_ openerOfTab:another_tab]);
EXPECT_EQ(parent_tab, [tab_model_ openerOfTab:child_tab]);
EXPECT_EQ(parent_tab, [tab_model_ openerOfTab:child_tab2]);
}
TEST_F(TabModelTest, OpenerOfTabEmptyModel) {
EXPECT_FALSE([tab_model_ openerOfTab:nil]);
}
TEST_F(TabModelTest, AddWithOrderController) { TEST_F(TabModelTest, AddWithOrderController) {
// Create a few tabs with the controller at the front. // Create a few tabs with the controller at the front.
Tab* parent = [tab_model_ insertTabWithURL:GURL(kURL1) Tab* parent = [tab_model_ insertTabWithURL:GURL(kURL1)
...@@ -935,12 +865,6 @@ TEST_F(TabModelTest, PersistSelectionChange) { ...@@ -935,12 +865,6 @@ TEST_F(TabModelTest, PersistSelectionChange) {
ASSERT_EQ(3U, [tab_model_ count]); ASSERT_EQ(3U, [tab_model_ count]);
[tab_model_ setCurrentTab:[tab_model_ tabAtIndex:1]]; [tab_model_ setCurrentTab:[tab_model_ tabAtIndex:1]];
EXPECT_EQ(nil, [tab_model_ openerOfTab:[tab_model_ tabAtIndex:1]]);
EXPECT_EQ([tab_model_ tabAtIndex:1],
[tab_model_ openerOfTab:[tab_model_ tabAtIndex:2]]);
EXPECT_EQ([tab_model_ tabAtIndex:2],
[tab_model_ openerOfTab:[tab_model_ tabAtIndex:0]]);
// Force state to flush to disk on the main thread so it can be immediately // Force state to flush to disk on the main thread so it can be immediately
// tested below. // tested below.
[test_session_service setPerformIO:YES]; [test_session_service setPerformIO:YES];
...@@ -960,11 +884,6 @@ TEST_F(TabModelTest, PersistSelectionChange) { ...@@ -960,11 +884,6 @@ TEST_F(TabModelTest, PersistSelectionChange) {
ASSERT_EQ(3u, [tab_model_ count]); ASSERT_EQ(3u, [tab_model_ count]);
EXPECT_EQ([tab_model_ tabAtIndex:1], [tab_model_ currentTab]); EXPECT_EQ([tab_model_ tabAtIndex:1], [tab_model_ currentTab]);
EXPECT_EQ(nil, [tab_model_ openerOfTab:[tab_model_ tabAtIndex:1]]);
EXPECT_EQ([tab_model_ tabAtIndex:1],
[tab_model_ openerOfTab:[tab_model_ tabAtIndex:2]]);
EXPECT_EQ([tab_model_ tabAtIndex:2],
[tab_model_ openerOfTab:[tab_model_ tabAtIndex:0]]);
// Clean up. // Clean up.
EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment