Bug 1272707, part 1 - Shrink down TV mock data test file so as to not exceed pref size limit. r=mantaroh
authorAndrew McCreight <continuation@gmail.com>
Tue, 17 May 2016 07:55:49 -0700
changeset 297672 a97d0c36d9934997f227f99ceae6a5ca4a4cad21
parent 297671 b8949c5d73cecaa965c4f817084e76da565eff80
child 297673 49b09d2f702f747e1b594649e947653a1c5c8c14
push id30264
push userkwierso@gmail.com
push dateTue, 17 May 2016 20:52:53 +0000
treeherdermozilla-central@991f249a6ffa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmantaroh
bugs1272707
milestone49.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 1272707, part 1 - Shrink down TV mock data test file so as to not exceed pref size limit. r=mantaroh The next patch will limit the size of preferences sent to content processes to MAX_ADVISABLE_PREF_LENGTH characters. This patch eliminates whitespace by converting to and from a JSON data structure. In addition, I reduced the size of the names and descriptions in mock_data.json.
dom/tv/test/mochitest/head.js
dom/tv/test/mochitest/mock_data.json
--- a/dom/tv/test/mochitest/head.js
+++ b/dom/tv/test/mochitest/head.js
@@ -11,16 +11,20 @@ function setupPrefsAndPermissions(callba
 function setupPrefs(callback) {
   let xhr = new XMLHttpRequest;
   let data;
 
   xhr.open("GET", "./mock_data.json", false);
   xhr.send(null);
   if (xhr.status == 200) {
     data = xhr.responseText;
+    // Convert the JSON to text and back to eliminate whitespace.
+    data = JSON.stringify(JSON.parse(data));
+    // Preferences can only be 4000 characters in a content process.
+    ok(data.length <= 4000, "Data for preferences must be 4000 characters or less.");
   }
 
   SpecialPowers.pushPrefEnv({"set": [
                               ["dom.tv.enabled", true],
                               ["dom.ignore_webidl_scope_checks", true],
                               ["dom.testing.tv_mock_data", data]
                             ]}, function() {
     callback();
--- a/dom/tv/test/mochitest/mock_data.json
+++ b/dom/tv/test/mochitest/mock_data.json
@@ -13,87 +13,87 @@
              "serviceId": "40960",
              "type": "tv",
              "name": "TV #1",
              "number" : 1,
              "isEmergency": false,
              "isFree" : true,
              "videoFilePath": "tv1.ogv",
              "programs": [
-               {"eventId":"734475972", "title":"News of Morning",  "startTime":"1430686800", "duration":"10800", "description":"Morning News", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
-               {"eventId":"422158917", "title":"News of Midnight",  "startTime":"1431266400", "duration":"3600",  "description":"Summary of today news",  "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
-               {"eventId":"533612446", "title":"Entertainment Program",  "startTime":"1431270000", "duration":"7200",  "description":"Midnight entertainment program", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]}
+               {"eventId":"734475972", "title":"News 1",  "startTime":"1430686800", "duration":"10800", "description":"Morning News", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
+               {"eventId":"422158917", "title":"News 2",  "startTime":"1431266400", "duration":"3600",  "description":"Summary of today news",  "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
+               {"eventId":"533612446", "title":"Entertainment",  "startTime":"1431270000", "duration":"7200",  "description":"Some show", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]}
                ]
              },
              {
              "_comment": "Channel Data",
              "networkId": "32122",
              "transportStreamId": "32122",
              "serviceId": "40990",
              "type": "tv",
              "name": "TV #2",
              "number" : 2,
              "isEmergency": false,
              "isFree" : true,
              "videoFilePath": "tv2.ogv",
              "programs": [
-                 {"eventId":"931109607","title":"News of Morning",	"startTime":"1430686800",	"duration":"10800",	"description":"Provide news in morning",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]},
+                 {"eventId":"931109607","title":"News 1",	"startTime":"1430686800",	"duration":"10800",	"description":"Provide news in morning",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]},
                  {"eventId":"297834220","title":"Weekly News",	"startTime":"1431259200",	"duration":"10800",	"description":"Poopular Music program",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]},
                  {"eventId":"866886159","title":"Weekly news",	"startTime":"1431270000",	"duration":"7200",	"description":"Information program on Monday",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]}
                ]
              },
              {
              "_comment": "Channel Data",
              "networkId": "32132",
              "transportStreamId": "32132",
              "serviceId": "41020",
              "type": "tv",
              "name": "TV #3",
              "number" : 3,
              "isEmergency": false,
              "isFree" : true,
              "videoFilePath": "tv1.ogv",
              "programs": [
-               {"eventId":"734475972", "title":"News of Morning",  "startTime":"1430686800", "duration":"10800", "description":"Morning News", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
-               {"eventId":"586216742", "title":"Information Program", "startTime":"1430697600", "duration":"7200",  "description":"Provide program Information.",  "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
-               {"eventId":"533612446", "title":"Entertainment Program",  "startTime":"1431270000", "duration":"7200",  "description":"Midnight entertainment program", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]}
+               {"eventId":"734475972", "title":"News 1",  "startTime":"1430686800", "duration":"10800", "description":"Morning News", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
+               {"eventId":"586216742", "title":"Info Program", "startTime":"1430697600", "duration":"7200",  "description":"Provide program Information.",  "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
+               {"eventId":"533612446", "title":"Entertainment",  "startTime":"1431270000", "duration":"7200",  "description":"Some show", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]}
                ]
              },
              {
              "_comment": "Channel Data",
              "networkId": "32142",
              "transportStreamId": "32142",
              "serviceId": "41040",
              "type": "tv",
              "name": "TV #5",
              "number" : 4,
              "isEmergency": false,
              "isFree" : true,
              "videoFilePath": "tv2.ogv",
              "programs": [
-                 {"eventId":"931109607","title":"News of Morning",	"startTime":"1430686800",	"duration":"10800",	"description":"Provide news in morning",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]},
+                 {"eventId":"931109607","title":"News 1",	"startTime":"1430686800",	"duration":"10800",	"description":"Provide news in morning",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]},
                  {"eventId":"297834220","title":"Weekly News",	"startTime":"1431259200",	"duration":"10800",	"description":"Poopular Music program",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]},
                  {"eventId":"866886159","title":"Weekly news",	"startTime":"1431270000",	"duration":"7200",	"description":"Information program on Monday",	"rating":"0",	"audioLanguages":["eng"],	"subtitleLanguages":["eng"]}
                ]
              },
              {
              "_comment": "Channel Data",
              "networkId": "32152",
              "transportStreamId": "32152",
              "serviceId": "41060",
              "type": "tv",
              "name": "TV #5",
              "number" : 5,
              "isEmergency": false,
              "isFree" : true,
              "videoFilePath": "tv1.ogv",
              "programs": [
-               {"eventId":"734475972", "title":"News of Morning",  "startTime":"1430686800", "duration":"10800", "description":"Morning News", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
-               {"eventId":"586216742", "title":"Information Program", "startTime":"1430697600", "duration":"7200",  "description":"Provide program Information.",  "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
-               {"eventId":"533612446", "title":"Entertainment Program",  "startTime":"1431270000", "duration":"7200",  "description":"Midnight entertainment program", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]}
+               {"eventId":"734475972", "title":"News 1",  "startTime":"1430686800", "duration":"10800", "description":"Morning News", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
+               {"eventId":"586216742", "title":"Info Program", "startTime":"1430697600", "duration":"7200",  "description":"Provide program Information.",  "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]},
+               {"eventId":"533612446", "title":"Entertainment",  "startTime":"1431270000", "duration":"7200",  "description":"Some show", "rating":"0", "audioLanguages":["eng"], "subtitleLanguages":["eng"]}
                ]
              }
            ]
          }
        ]
     }
   ]
-}
\ No newline at end of file
+}