Bug 1411657: 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 686352 8f78370f7b141024d5e7d5a6c668572e33f525d1
parent 686339 9bb693e83ec98a8c1bae6476b2c800cf89968bd3
child 737366 be1fda2765cfc3821a7bda880cc60abe86fadfb9
push id86175
push usermichael.l.comella@gmail.com
push dateWed, 25 Oct 2017 20:38:08 +0000
Bug 1411657: Disable testActivityStreamPocketReferrer when Pocket is disabled by default. r=liuche MozReview-Commit-ID: BoFaNc4eBUA
--- 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
         // 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.
     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;
+        }
         NavigationHelper.goBack(); // to top sites.
         checkNoReferrerInTopSites(); // relies on changes to Top Sites from previous tests.