Bug 1162531 - Add test for add-ons in distributions. r=rnewman
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 11 May 2015 09:36:00 -0700
changeset 243959 c113a12800202e13d07c52f7b28a02383ea7f5f2
parent 243958 2295894af36b22dfa2ec7420d0876fa14a84b89f
child 243960 c19c7176325efc3cb8c1b754def70a1a46c3b958
push id28761
push usercbook@mozilla.com
push dateFri, 15 May 2015 14:50:10 +0000
treeherdermozilla-central@c0e709a5baca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1162531
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1162531 - Add test for add-ons in distributions. r=rnewman
mobile/android/tests/browser/robocop/assets/mock-package.zip
mobile/android/tests/browser/robocop/testDistribution.java
index 7c299823caeed7a27055cc121d79b5b9cbeadea2..9a0c5e6c95f5348cea461e4c60340c96a36a4b15
GIT binary patch
literal 5094
zc$}4&2{@E{`^PPjELkF1OSWWR5>jI+5@XFUvJEq1H=4m%!kl8r-q;C8q(x;ZS;pR2
zv&&wHgD7kE^>5C3k2CcCJH5|y{jPbQnd|qt@8^E5`QG<eUz_p>EgA7BzMi8&MshHa
zF_A$XQ0_<v8xMB}gsY^nDLt8am%cG^Et9j7>F;f2C8OCp2@s$f=~k}8TWt^sCl?6P
z2_@l(Lbwt^OiNq_#6<*!MUGSK(T>tw?X-8J+S^aLxAgZDt2>m~sl#-bmpjZAwReU3
zGe^{3eyAUE)I3B{{0W8hdkJ?K%3Z|;;p5=!43R(}?IgV19Ef3j_CjDg{|ZAl4~H{D
ztgT0^L)@%pJSU^)8r?Ohu`EK=)V$Oj*sQHB+$io5fuj7yXgiZG^#l()rCN?8RbV{G
zO;)Pl4%K<8udb;hiGKAezb|hC40hJxpH7r-%DEJMoM20OqdGoQGk)XAX-x&)uUaVu
zv8$85{ag36#f(2#`AGOzqP@YZo3&Huc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sIw5=XNyaisJg1&)+{^7yaO|CT$NeYqp8J~0NV1YAB)eb@gf#($MQntkch*QTN-
Qa_RR@%f0^@l971#f5Dgkz5oCK
--- a/mobile/android/tests/browser/robocop/testDistribution.java
+++ b/mobile/android/tests/browser/robocop/testDistribution.java
@@ -48,16 +48,18 @@ import android.util.Log;
  *     bookmarks.json
  *     searchplugins/
  *       common/
  *         engine.xml
  *     suggestedsites/
  *       locales/
  *         en-US/
  *           suggestedsites.json
+ *     extensions/
+ *       distribution.test@mozilla.org.xpi
  */
 public class testDistribution extends ContentProviderTest {
     private static final String CLASS_REFERRER_RECEIVER = "org.mozilla.gecko.distribution.ReferrerReceiver";
     private static final String ACTION_INSTALL_REFERRER = "com.android.vending.INSTALL_REFERRER";
     private static final int WAIT_TIMEOUT_MSEC = 10000;
     public static final String LOGTAG = "GeckoTestDistribution";
 
     public static class TestableDistribution extends Distribution {
@@ -147,16 +149,17 @@ public class testDistribution extends Co
 
         // Pre-clear distribution pref, run basic preferences and en-US localized preferences Tests
         clearDistributionPref();
         setTestLocale("en-US");
         initDistribution(mockPackagePath);
         checkPreferences();
         checkLocalizedPreferences("en-US");
         checkSearchPlugin();
+        checkAddon();
 
         // Pre-clear distribution pref, and run es-MX localized preferences Test
         clearDistributionPref();
         setTestLocale("es-MX");
         initDistribution(mockPackagePath);
         checkLocalizedPreferences("es-MX");
 
         // Test the (stubbed) download interaction.
@@ -298,30 +301,17 @@ public class testDistribution extends Co
         try {
             final String[] prefNames = { prefID,
                                          prefAbout,
                                          prefVersion,
                                          prefTestBoolean,
                                          prefTestString,
                                          prefTestInt };
 
-            Actions.RepeatedEventExpecter eventExpecter = mActions.expectGeckoEvent("Preferences:Data");
-            mActions.sendPreferencesGetEvent(PREF_REQUEST_ID, prefNames);
-
-            JSONObject data = null;
-            int requestId = -1;
-
-            // Wait until we get the correct "Preferences:Data" event
-            while (requestId != PREF_REQUEST_ID) {
-                data = new JSONObject(eventExpecter.blockForEventData());
-                requestId = data.getInt("requestId");
-            }
-            eventExpecter.unregisterListener();
-
-            JSONArray preferences = data.getJSONArray("preferences");
+            final JSONArray preferences = getPrefs(prefNames);
             for (int i = 0; i < preferences.length(); i++) {
                 JSONObject pref = (JSONObject) preferences.get(i);
                 String name = pref.getString("name");
 
                 if (name.equals(prefID)) {
                     mAsserter.is(pref.getString("value"), "test-partner", "check " + prefID);
                 } else if (name.equals(prefAbout)) {
                     mAsserter.is(pref.getString("value"), "Test Partner", "check " + prefAbout);
@@ -359,16 +349,44 @@ public class testDistribution extends Co
                 }
             }
             mAsserter.ok(foundEngine, "check search plugin", "found test search plugin");
         } catch (JSONException e) {
             mAsserter.ok(false, "exception getting search plugins", e.toString());
         }
     }
 
+    private void checkAddon() {
+        try {
+            final String[] prefNames = { "distribution.test.addonEnabled" };
+            final JSONArray preferences = getPrefs(prefNames);
+            final JSONObject pref = (JSONObject) preferences.get(0);
+            mAsserter.is(pref.getBoolean("value"), true, "check distribution add-on is enabled");
+        } catch (JSONException e) {
+            mAsserter.ok(false, "exception getting preferences", e.toString());
+        }
+    }
+
+    private JSONArray getPrefs(String[] prefNames) throws JSONException {
+        Actions.RepeatedEventExpecter eventExpecter = mActions.expectGeckoEvent("Preferences:Data");
+        mActions.sendPreferencesGetEvent(PREF_REQUEST_ID, prefNames);
+
+        JSONObject data = null;
+        int requestId = -1;
+
+        // Wait until we get the correct "Preferences:Data" event
+        while (requestId != PREF_REQUEST_ID) {
+            data = new JSONObject(eventExpecter.blockForEventData());
+            requestId = data.getInt("requestId");
+        }
+        eventExpecter.unregisterListener();
+
+        return data.getJSONArray("preferences"); 
+    }
+
     // Sets the distribution locale preference for the test.
     private void setTestLocale(String locale) {
         BrowserLocaleManager.getInstance().setSelectedLocale(mActivity, locale);
     }
 
     // Test localized distribution and preferences values stored in preferences.json
     private void checkLocalizedPreferences(String aLocale) {
         String prefAbout = "distribution.about";