Bug 971279 - Fix FHR addon provider test for plugin data count. r=gps
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 21 Feb 2014 05:42:31 +0100
changeset 170902 12b636c82b24eefd24876981c39829523acc550b
parent 170901 7254cd0a6d75a0db751e8ef8e524039d1ce1b409
child 170903 19a4abd04dceab5eba3cf936dca901e63823808e
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersgps
bugs971279
milestone30.0a1
Bug 971279 - Fix FHR addon provider test for plugin data count. r=gps
services/healthreport/tests/xpcshell/test_provider_addons.js
--- a/services/healthreport/tests/xpcshell/test_provider_addons.js
+++ b/services/healthreport/tests/xpcshell/test_provider_addons.js
@@ -138,16 +138,27 @@ add_task(function test_collect() {
       "description": "Second plug-in for testing purposes.",
       "blocklisted": false,
       "disabled": false,
       "clicktoplay": false,
       "mimeTypes":[
         "application/x-second-test"
       ],
     },
+    "Java Test Plug-in":
+    {
+      "version": "1.0.0.0",
+      "description": "Dummy Java plug-in for testing purposes.",
+      "blocklisted": false,
+      "disabled": false,
+      "clicktoplay": false,
+      "mimeTypes":[
+        "application/x-java-test"
+      ],
+    },
   };
 
   let pluginTags = Cc["@mozilla.org/plugin/host;1"]
                     .getService(Ci.nsIPluginHost)
                     .getPluginTags({});
 
   for (let tag of pluginTags) {
     if (tag.name in testPlugins) {
@@ -191,20 +202,21 @@ add_task(function test_collect() {
 
   do_check_eq(data.days.size, 0);
   do_check_eq(data.singular.size, 1);
   do_check_true(data.singular.has("plugins"));
 
   json = data.singular.get("plugins")[1];
   value = JSON.parse(json);
   do_check_eq(typeof(value), "object");
-  do_check_eq(Object.keys(value).length, 2);
+  do_check_eq(Object.keys(value).length, pluginTags.length);
 
   do_check_true(testPlugins["Test Plug-in"].id in value);
   do_check_true(testPlugins["Second Test Plug-in"].id in value);
+  do_check_true(testPlugins["Java Test Plug-in"].id in value);
 
   for (let id in value) {
     let item = value[id];
     let testData = testPlugins[item.name];
     for (let prop in testData) {
       if (prop == "mimeTypes" || prop == "id") {
         continue;
       }
@@ -214,33 +226,33 @@ add_task(function test_collect() {
     for (let mime of testData.mimeTypes) {
       do_check_true(item.mimeTypes.indexOf(mime) != -1);
     }
   }
 
   serializer = plugins.serializer(plugins.SERIALIZE_JSON);
   serialized = serializer.singular(data.singular);
   do_check_eq(typeof(serialized), "object");
-  do_check_eq(Object.keys(serialized).length, 3); // Our entries, plus _v.
+  do_check_eq(Object.keys(serialized).length, pluginTags.length+1); // Our entries, plus _v.
   for (let name in testPlugins) {
     do_check_true(testPlugins[name].id in serialized);
   }
   do_check_eq(serialized._v, 1);
 
   // Test counts measurement.
 
   let counts = provider.getMeasurement("counts", 2);
   data = yield counts.getValues();
   do_check_eq(data.days.size, 1);
   do_check_eq(data.singular.size, 0);
   do_check_true(data.days.hasDay(now));
 
   value = data.days.getDay(now);
   do_check_eq(value.size, 4);
   do_check_eq(value.get("extension"), 1);
-  do_check_eq(value.get("plugin"), 2);
+  do_check_eq(value.get("plugin"), pluginTags.length);
   do_check_eq(value.get("theme"), 1);
   do_check_eq(value.get("service"), 1);
 
   yield provider.shutdown();
   yield storage.close();
 });