update test to use templates, r?bsilverberg draft
authorEthan Glasser-Camp <eglassercamp@mozilla.com>
Tue, 31 May 2016 11:19:41 -0400
changeset 383171 3f97d3fc83d060f007ea0087c2c50dfc7d089bbc
parent 383170 dd00e2b23cc618e6a369aa99335057c3a7ff52e4
child 524417 263cfab1a090122d28d817b8939c3b179299828d
push id21961
push usereglassercamp@mozilla.com
push dateFri, 01 Jul 2016 19:26:33 +0000
reviewersbsilverberg
milestone50.0a1
update test to use templates, r?bsilverberg Also, add another variable to the failure messages now that they are being run for each area. MozReview-Commit-ID: ApKFhWsW3DM
toolkit/components/extensions/test/mochitest/test_ext_storage.html
--- a/toolkit/components/extensions/test/mochitest/test_ext_storage.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_storage.html
@@ -31,26 +31,26 @@ function backgroundScript() {
   const invalidatedLocal = new Promise(listenFor("invalidated-local")),
         invalidatedSync = new Promise(listenFor("invalidated-sync")),
         flagTurnedOff = new Promise(listenFor("flag-turned-off"));
   const invalidatedPromises = {local: invalidatedLocal, sync: invalidatedSync};
 
   function checkGet(areaName, prop, value) {
     let storage = browser.storage[areaName];
     return storage.get(null).then(data => {
-      browser.test.assertEq(value, data[prop], "null getter worked for " + prop);
+      browser.test.assertEq(value, data[prop], `null getter worked for ${prop} in ${areaName}`);
       return storage.get(prop);
     }).then(data => {
-      browser.test.assertEq(value, data[prop], "string getter worked for " + prop);
+      browser.test.assertEq(value, data[prop], `string getter worked for ${prop} in ${areaName}`);
       return storage.get([prop]);
     }).then(data => {
-      browser.test.assertEq(value, data[prop], "array getter worked for " + prop);
+      browser.test.assertEq(value, data[prop], `array getter worked for ${prop} in ${areaName}`);
       return storage.get({[prop]: undefined});
     }).then(data => {
-      browser.test.assertEq(value, data[prop], "object getter worked for " + prop);
+      browser.test.assertEq(value, data[prop], `object getter worked for ${prop} in ${areaName}`);
     });
   }
 
   let globalChanges = {};
   let expectedAreaName;
 
   browser.storage.onChanged.addListener((changes, areaName) => {
     browser.test.assertEq(expectedAreaName, areaName,
@@ -235,17 +235,17 @@ function backgroundScript() {
   }).then(() => {
     browser.test.notifyPass("storage");
   }).catch(e => {
     browser.test.fail(JSON.stringify(e));
   });
 }
 
 let extensionData = {
-  background: "(" + backgroundScript.toString() + ")()",
+  background: `(${backgroundScript})()`,
   manifest: {
     permissions: ["storage"],
   },
 };
 
 add_task(function* test_backgroundScript() {
   SpecialPowers.setBoolPref(STORAGE_SYNC_PREF, true);
   SimpleTest.registerCleanupFunction(() => {