Bug 1411749: Disable testActivityStreamPocketReferrer when Pocket is disabled by default. r=liuche draft
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 25 Oct 2017 13:32:59 -0700
changeset 686382 f61005db19cf942828ba3bc4aecac85a0def5f8f
parent 686339 9bb693e83ec98a8c1bae6476b2c800cf89968bd3
child 737372 a4338b343e9dabe1373e258c82a5ae94277bf03b
push id86182
push usermichael.l.comella@gmail.com
push dateWed, 25 Oct 2017 20:58:19 +0000
reviewersliuche
bugs1411749
milestone58.0a1
Bug 1411749: Disable testActivityStreamPocketReferrer when Pocket is disabled by default. r=liuche MozReview-Commit-ID: BoFaNc4eBUA
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testActivityStreamPocketReferrer.java
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testActivityStreamPocketReferrer.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testActivityStreamPocketReferrer.java
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.tests;
 
 import android.util.Log;
 import com.robotium.solo.Condition;
+import org.mozilla.gecko.R;
 import org.mozilla.gecko.activitystream.homepanel.topstories.PocketStoriesLoader;
 import org.mozilla.gecko.tests.helpers.NavigationHelper;
 import org.mozilla.gecko.tests.helpers.WaitHelper;
 import org.mozilla.gecko.util.StringUtils;
 
 import static org.mozilla.gecko.tests.helpers.AssertionHelper.*;
 
 /**
@@ -43,16 +44,23 @@ public class testActivityStreamPocketRef
         super.setUp();
 
         // Override the default placeholder URL so we don't access the network during testing.
         // Note: this actually only seems to take effect after we load a page and go back to about:home.
         PocketStoriesLoader.configureForTesting(getAbsoluteHostnameUrl(StringHelper.get().ROBOCOP_BLANK_PAGE_01_URL));
     }
 
     public void testActivityStreamPocketReferrer() throws Exception {
+        if (!getActivity().getResources().getBoolean(R.bool.pref_activitystream_pocket_enabled_default)) {
+            // I don't have time to add code to force enable Pocket suggestions so we'll just assume
+            // this won't break until we re-enable Pocket by default (bug 1411657).
+            Log.d(LOGTAG, "Pocket recommendations are disabled by default; returning success...");
+            return;
+        }
+
         blockForReadyAndLoadJS(JS_FILE);
         NavigationHelper.goBack(); // to top sites.
 
         checkReferrerInTopStories();
         checkReferrerInTopStoriesContextMenu();
 
         checkNoReferrerInTopSites(); // relies on changes to Top Sites from previous tests.