Bug 1122123 - Fix WebIDE tests with async promises. r=me
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 15 Jan 2015 20:16:55 -0600
changeset 224176 7b98d254877ecacb167871c01286941d14d0fb66
parent 224175 0be338f328fb43a2942c92864ea3ab6bf9db7336
child 224177 c2498519af6eff3704062a15966cbe062fe740ff
push id54150
push usercbook@mozilla.com
push dateFri, 16 Jan 2015 14:14:56 +0000
treeherdermozilla-inbound@ac6623427298 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1122123
milestone38.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 1122123 - Fix WebIDE tests with async promises. r=me
browser/devtools/webide/content/devicepreferences.js
browser/devtools/webide/test/test_device_preferences.html
browser/devtools/webide/test/test_deviceinfo.html
--- a/browser/devtools/webide/content/devicepreferences.js
+++ b/browser/devtools/webide/content/devicepreferences.js
@@ -291,28 +291,30 @@ function SearchPref(event) {
     var trs = document.getElementsByTagName("tr");
 
     for (let i = 0; i < trs.length; i++) {
       trs[i].classList.remove("hide");
     }
   }
 }
 
+let getAllPrefs; // Used by tests
 function BuildUI() {
   table = document.querySelector("table");
   let trs = table.querySelectorAll("tr:not(#add-custom-preference)");
 
   for (var i = 0; i < trs.length; i++) {
     table.removeChild(trs[i]);
   }
 
   if (AppManager.connection &&
       AppManager.connection.status == Connection.Status.CONNECTED &&
       AppManager.preferenceFront) {
-    AppManager.preferenceFront.getAllPrefs().then(json => {
+    getAllPrefs = AppManager.preferenceFront.getAllPrefs();
+    getAllPrefs.then(json => {
       let devicePrefs = Object.keys(json);
       devicePrefs.sort();
       for (let i = 0; i < devicePrefs.length; i++) {
         GenerateField(devicePrefs[i], json[devicePrefs[i]].value, json[devicePrefs[i]].hasUserValue);
       }
     });
   } else {
     CloseUI();
--- a/browser/devtools/webide/test/test_device_preferences.html
+++ b/browser/devtools/webide/test/test_device_preferences.html
@@ -41,16 +41,17 @@
 
           ok(!prefs.hasAttribute("disabled"), "device prefs cmd enabled");
 
           let deck = win.document.querySelector("#deck");
 
           win.Cmds.showDevicePrefs();
           is(deck.selectedPanel, prefIframe, "device preferences iframe selected");
 
+          yield prefIframe.contentWindow.getAllPrefs;
           yield nextTick();
 
           let doc = prefIframe.contentWindow.document;
           let fields = doc.querySelectorAll(".editable");
           let preference = "accessibility.blockautorefresh";
           let found = false;
 
           // Trigger existing field change
--- a/browser/devtools/webide/test/test_deviceinfo.html
+++ b/browser/devtools/webide/test/test_deviceinfo.html
@@ -44,17 +44,17 @@
           ok(!perm.hasAttribute("disabled"), "perm cmd enabled");
           ok(!info.hasAttribute("disabled"), "info cmd enabled");
 
           let deck = win.document.querySelector("#deck");
 
           win.Cmds.showRuntimeDetails();
           is(deck.selectedPanel, infoIframe, "info iframe selected");
 
-          yield infoIframe.contentWindow.getRawPermissionsTablePromise;
+          yield infoIframe.contentWindow.getDescriptionPromise;
 
           yield nextTick();
 
           // device info and permissions content is checked in other tests
           // We just test one value to make sure we get something
 
           let doc = infoIframe.contentWindow.document;
           let trs = doc.querySelectorAll("tr");
@@ -67,17 +67,17 @@
               is(val.textContent, Services.appinfo.ID, "appid has the right value");
             }
           }
           ok(found, "Found appid line");
 
           win.Cmds.showPermissionsTable();
           is(deck.selectedPanel, permIframe, "permission iframe selected");
 
-          yield infoIframe.contentWindow.getDescriptionPromise;
+          yield permIframe.contentWindow.getRawPermissionsTablePromise;
 
           yield nextTick();
 
           doc = permIframe.contentWindow.document;
           trs = doc.querySelectorAll(".line");
           found = false;
           for (let tr of trs) {
             let [name,v1,v2,v3] = tr.querySelectorAll("td");