Bug 1402549 - Part 2 - Use something else to trigger session store activity. r?esawin draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 10 Mar 2018 14:19:23 +0100
changeset 765896 00027d9ec9f55e1478bbc1e5b3956b86d0fc93cd
parent 765895 f5e97da739be61b209e0c7985634e3d8dc168403
child 765953 46255cc10c00d855f1bcc9084b95f435cef58be3
child 765960 27751caf34fa9be714bf243c73cc37d8af51cf78
push id102174
push usermozilla@buttercookie.de
push dateSat, 10 Mar 2018 16:08:47 +0000
reviewersesawin
bugs1402549
milestone60.0a1
Bug 1402549 - Part 2 - Use something else to trigger session store activity. r?esawin Instead of adding and immediately closing a tab, which carries the risk that we catch a session store file that was written just in-between those two operations (although part 1 means that we should be able to handle this safely now), we just reload the current tab. MozReview-Commit-ID: JbiH8rmbbwJ
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testSessionFilePreservation.java
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testSessionFilePreservation.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testSessionFilePreservation.java
@@ -1,16 +1,17 @@
 package org.mozilla.gecko.tests;
 
 import android.content.Intent;
 import android.util.Log;
 
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.tests.helpers.GeckoHelper;
+import org.mozilla.gecko.tests.helpers.NavigationHelper;
 
 /**
  * Tests session OOM save behavior.
  *
  * Builds a session on disk, restores it and tests that
  * it is then written back to disk correctly.
  */
 public class testSessionFilePreservation extends SessionTest {
@@ -40,18 +41,17 @@ public class testSessionFilePreservation
         // not accidentally reloading them.
 
         // To make sure we're not simply verifying the very same file we've generated
         // and written ourselves further up, we delete it...
         deleteProfileFile("sessionstore.js");
 
         // ... and then trigger some session store activity to make sure
         // that a fresh session file is written.
-        Tab tab = Tabs.getInstance().addTab();
-        Tabs.getInstance().closeTab(tab);
+        NavigationHelper.reload();
 
         // Verify sessionstore.js written by Gecko. The session write is delayed
         // to batch successive changes, so the file is repeatedly read until it
         // matches the expected output. Because of the delay, this part of the
         // test takes ~9 seconds to pass.
         VerifyJSONCondition verifyJSONCondition = new VerifyJSONCondition(mSession);
         boolean success = mSolo.waitForCondition(verifyJSONCondition, SESSION_TIMEOUT);
         if (success) {