Bug 1351677 - Update browser_remoteness_flip_on_restore test to account for initial tab swapping. r?mikedeboer draft
authorMike Conley <mconley@mozilla.com>
Tue, 04 Apr 2017 16:01:28 -0400
changeset 556316 2fe00dd3e308f38901c162dfce0aefd3cce48740
parent 556315 a9a040ad1b14cedb52b92bf5ec752f9ec1e873e7
child 556317 13340af896dec1653ca6b8e91e7be9b55d94ca80
push id52501
push usermconley@mozilla.com
push dateWed, 05 Apr 2017 16:14:11 +0000
reviewersmikedeboer
bugs1351677
milestone55.0a1
Bug 1351677 - Update browser_remoteness_flip_on_restore test to account for initial tab swapping. r?mikedeboer MozReview-Commit-ID: 152bkpjVsPv
browser/components/sessionstore/test/browser_remoteness_flip_on_restore.js
--- a/browser/components/sessionstore/test/browser_remoteness_flip_on_restore.js
+++ b/browser/components/sessionstore/test/browser_remoteness_flip_on_restore.js
@@ -293,51 +293,67 @@ add_task(function*() {
     },
 
     // A single non-remote tab.
     {
       initialRemoteness: [false],
       initialSelectedTab: 1,
       stateToRestore: SIMPLE_STATE,
       selectedTab: 2,
-      // The initial tab is non-remote and should become remote.
-      // The second and third tabs are new and should be initialized
-      // as remote.
-      expectedFlips: [true, false, false],
+      // The initial tab is non-remote and will flip. The two tabs that
+      // are added after should be initialized as remote. Since the selected
+      // tab is changing, SessionStore should swap the initial tab with the
+      // tab thats in the selectedTab slot. That'll result in a remoteness
+      // state like this:
+      //
+      // [true, false, true]
+      expectedFlips: [false, true, false],
       // All tabs should now be remote.
       expectedRemoteness: [true, true, true],
     },
 
     // A mixture of remote and non-remote tabs.
     {
       initialRemoteness: [true, false, true],
       initialSelectedTab: 1,
       stateToRestore: SIMPLE_STATE,
       selectedTab: 3,
       // The initial tab is remote and should stay that way, even
-      // when put into the background. The second tab should flip
-      // remoteness, and the third one should stay remote.
+      // when put into the background. The initial tab is going to be
+      // swapped into the selectedTab slot, and both of those tabs are
+      // remote already. That will result in the tabs remoteness being
+      // in this order still:
+      //
+      // [true, false, true]
+      //
+      // This means that we'll only need to flip the second tab.
       expectedFlips: [false, true, false],
       // All tabs should now be remote.
       expectedRemoteness: [true, true, true],
     },
 
     // An initially non-remote tab, but we're going to load
     // some pinned tabs now, and the pinned tabs should load
     // right away.
     {
       initialRemoteness: [false],
       initialSelectedTab: 1,
       stateToRestore: PINNED_STATE,
       selectedTab: 3,
-      // The initial tab is pinned and will load right away,
-      // so it should flip remoteness. The second tab is new
-      // and pinned, so it should start remote and not flip.
-      // The third tab is not pinned, but it is selected,
-      // so it will start remote, and not flip remoteness.
-      expectedFlips: [true, false, false],
+      // The initial tab is going to swap into the selected slot,
+      // and so after the other two tabs from the PINNED_STATE are
+      // inserted, we'll have a remoteness state like this:
+      //
+      // [true, true, false]
+      //
+      // The two pinned tabs at the start of the PINNED_STATE should
+      // load right away, but should not flip remoteness.
+      //
+      // The third tab is selected, and should load right away, so
+      // it should flip remoteness.
+      expectedFlips: [false, false, true],
       // All tabs should now be remote.
       expectedRemoteness: [true, true, true],
     },
   ];
 
   yield* runScenarios(TEST_SCENARIOS);
 });