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

Unified Diff: ios/chrome/browser/tabs/tab_model_unittest.mm

Issue 2697193004: Add opener-opened relationship between WebState in WebStateList. (Closed)
Patch Set: Fix copy-n-paste error. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/tabs/tab_model_unittest.mm
diff --git a/ios/chrome/browser/tabs/tab_model_unittest.mm b/ios/chrome/browser/tabs/tab_model_unittest.mm
index c28266e9305f38fa2675ecc07fa7be60dd8bd7b1..5c06b91f863d397467257e4150c4202550a92382 100644
--- a/ios/chrome/browser/tabs/tab_model_unittest.mm
+++ b/ios/chrome/browser/tabs/tab_model_unittest.mm
@@ -838,11 +838,24 @@ TEST_F(TabModelTest, PersistSelectionChange) {
browserState:chrome_browser_state.get()]);
[model addTabWithURL:kURL referrer:kReferrer windowName:@"window 1"];
- [model addTabWithURL:kURL referrer:kReferrer windowName:@"window 2"];
- [model addTabWithURL:kURL referrer:kReferrer windowName:@"window 3"];
+ [model insertTabWithURL:kURL
+ referrer:kReferrer
+ windowName:@"window 3"
+ opener:[model tabAtIndex:0]
+ atIndex:[model count]];
+ [model insertTabWithURL:kURL
+ referrer:kReferrer
+ windowName:@"window 3"
+ opener:[model tabAtIndex:1]
+ atIndex:0];
ASSERT_EQ(3U, [model count]);
- model.get().currentTab = [model tabAtIndex:1];
+ [model setCurrentTab:[model tabAtIndex:1]];
+
+ EXPECT_EQ(nil, [model openerOfTab:[model tabAtIndex:1]]);
+ EXPECT_EQ([model tabAtIndex:1], [model openerOfTab:[model tabAtIndex:2]]);
+ EXPECT_EQ([model tabAtIndex:2], [model openerOfTab:[model tabAtIndex:0]]);
+
// Force state to flush to disk on the main thread so it can be immediately
// tested below.
SessionWindowIOS* window = [model windowForSavingSession];
@@ -866,7 +879,13 @@ TEST_F(TabModelTest, PersistSelectionChange) {
initWithSessionWindow:sessionWindow
sessionService:test_service
browserState:chrome_browser_state.get()]);
- EXPECT_EQ(model.get().currentTab, [model tabAtIndex:1]);
+ ASSERT_EQ(3u, [model count]);
+
+ EXPECT_EQ([model tabAtIndex:1], [model currentTab]);
+ EXPECT_EQ(nil, [model openerOfTab:[model tabAtIndex:1]]);
+ EXPECT_EQ([model tabAtIndex:1], [model openerOfTab:[model tabAtIndex:2]]);
+ EXPECT_EQ([model tabAtIndex:2], [model openerOfTab:[model tabAtIndex:0]]);
+
[model browserStateDestroyed];
model.reset();

Powered by Google App Engine
This is Rietveld 408576698