Bug 828008 - Test fix for responsive mode UA. r=vporof a=bustage
☠☠ backed out by ab22ba41b8fc ☠ ☠
authorTim Nguyen <ntim.bugs@gmail.com>
Tue, 29 Dec 2015 09:46:01 -0800
changeset 277870 426164db47c6e9e7bd5216efcbe5743606f1c12b
parent 277869 6dbba51c24d2386624557368feaed125e5a32a63
child 277871 2f14aeae6e06a397d48f80f76608843a099771b7
push id69628
push usercbook@mozilla.com
push dateWed, 30 Dec 2015 11:16:09 +0000
treeherdermozilla-inbound@b493cf33851f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof, bustage
bugs828008
milestone46.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 828008 - Test fix for responsive mode UA. r=vporof a=bustage
devtools/client/responsivedesign/responsivedesign.jsm
devtools/client/responsivedesign/test/browser_responsiveui_customuseragent.js
--- a/devtools/client/responsivedesign/responsivedesign.jsm
+++ b/devtools/client/responsivedesign/responsivedesign.jsm
@@ -890,17 +890,19 @@ ResponsiveUI.prototype = {
 
   changeUA: function() {
     var value = this.userAgentInput.value;
     if (value !== "") {
       this.userAgentInput.setAttribute("attention", "true");
     } else {
       this.userAgentInput.removeAttribute("attention", "true");
     }
-    this.tabClient.reconfigure({customUserAgent: value});
+    this.tabClient.reconfigure({customUserAgent: value}, () => {
+      ResponsiveUIManager.emit("userAgentChanged", { tab: this.tab });
+    });
   },
 
   /**
    * Change the size of the browser.
    *
    * @param aWidth width of the browser.
    * @param aHeight height of the browser.
    */
--- a/devtools/client/responsivedesign/test/browser_responsiveui_customuseragent.js
+++ b/devtools/client/responsivedesign/test/browser_responsiveui_customuseragent.js
@@ -15,42 +15,44 @@ add_task(function*() {
   let selectedTab = gBrowser.selectedTab;
 
   let mgrOn = once(mgr, "connectedToServer");
   mgr.toggle(window, selectedTab);
   yield mgrOn;
   yield testUserAgent(DEFAULT_UA);
 
   info("Setting UA to " + CHROME_UA);
-  setUserAgent(CHROME_UA);
+  yield setUserAgent(CHROME_UA);
   yield testUserAgent(CHROME_UA);
 
   info("Resetting UA");
-  setUserAgent("");
+  yield setUserAgent("");
   yield testUserAgent(DEFAULT_UA);
 
   info("Setting UA to " + CHROME_UA);
-  setUserAgent(CHROME_UA);
+  yield setUserAgent(CHROME_UA);
   yield testUserAgent(CHROME_UA);
 
   info("Closing responsive mode");
   let mgrOff = once(mgr, "off");
   mgr.toggle(window, selectedTab);
   yield mgrOff;
   yield testUserAgent(DEFAULT_UA);
 });
 
-function setUserAgent(ua) {
+function* setUserAgent(ua) {
   let mgr = ResponsiveUI.ResponsiveUIManager;
   let instance = mgr.getResponsiveUIForTab(gBrowser.selectedTab);
   let input = instance.userAgentInput;
 
   input.focus();
   input.value = ua;
+  let onUAChanged = once(mgr, "userAgentChanged");
   input.blur();
+  yield onUAChanged;
 
   if (ua !== "") {
     ok(input.hasAttribute("attention"), "UA input should be highlighted");
   } else {
     ok(!input.hasAttribute("attention"), "UA input shouldn't be highlighted");
   }
 }