Bug 828008 - Add test for responsive mode UA textbox. r=jryans
authorTim Nguyen <ntim.bugs@gmail.com>
Tue, 01 Mar 2016 18:48:15 +0100
changeset 324551 664023b706928c2d9a0e778a0865bdf00abffc25
parent 324550 750799a0d1a9e47bfdc7653e7f5b8e87816ae196
child 324552 ed627972a4806a23c79dae4a08f53c795becb8fb
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs828008
milestone47.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 - Add test for responsive mode UA textbox. r=jryans MozReview-Commit-ID: 7ZHxEICgIG6
devtools/client/responsivedesign/test/browser.ini
devtools/client/responsivedesign/test/browser_responsiveui_customuseragent.js
devtools/client/styleeditor/test/browser.ini
--- a/devtools/client/responsivedesign/test/browser.ini
+++ b/devtools/client/responsivedesign/test/browser.ini
@@ -2,13 +2,16 @@
 tags = devtools
 subsuite = devtools
 support-files =
   head.js
   touch.html
 
 [browser_responsive_cmd.js]
 [browser_responsivecomputedview.js]
+skip-if = e10s && debug && os == 'win' # Bug 1252201 - Docshell leak on win 7 debug e10s
 [browser_responsiveruleview.js]
+skip-if = e10s && debug && os == 'win' # Bug 1252201 - Docshell leak on win 7 debug e10s
 [browser_responsiveui.js]
 [browser_responsiveui_touch.js]
 [browser_responsiveuiaddcustompreset.js]
 [browser_responsive_devicewidth.js]
+[browser_responsiveui_customuseragent.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/responsivedesign/test/browser_responsiveui_customuseragent.js
@@ -0,0 +1,56 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_URI = "data:text/html, Custom User Agent test";
+const DEFAULT_UA = Cc["@mozilla.org/network/protocol;1?name=http"]
+                    .getService(Ci.nsIHttpProtocolHandler)
+                    .userAgent;
+const CHROME_UA = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36" +
+                  " (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36";
+add_task(function*() {
+  yield addTab(TEST_URI);
+
+  let {rdm, manager} = yield openRDM();
+  yield testUserAgent(DEFAULT_UA);
+
+  info("Setting UA to " + CHROME_UA);
+  yield setUserAgent(CHROME_UA, rdm, manager);
+  yield testUserAgent(CHROME_UA);
+
+  info("Resetting UA");
+  yield setUserAgent("", rdm, manager);
+  yield testUserAgent(DEFAULT_UA);
+
+  info("Setting UA to " + CHROME_UA);
+  yield setUserAgent(CHROME_UA, rdm, manager);
+  yield testUserAgent(CHROME_UA);
+
+  info("Closing responsive mode");
+
+  yield closeRDM(rdm);
+  yield testUserAgent(DEFAULT_UA);
+});
+
+function* setUserAgent(ua, rdm, manager) {
+  let input = rdm.userAgentInput;
+  input.focus();
+  input.value = ua;
+  let onUAChanged = once(manager, "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");
+  }
+}
+
+function* testUserAgent(value) {
+  let ua = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function*() {
+    return content.navigator.userAgent;
+  });
+  is(ua, value, `UA should be set to ${value}`);
+}
--- a/devtools/client/styleeditor/test/browser.ini
+++ b/devtools/client/styleeditor/test/browser.ini
@@ -63,16 +63,17 @@ support-files =
 [browser_styleeditor_highlight-selector.js]
 [browser_styleeditor_import.js]
 [browser_styleeditor_import_rule.js]
 [browser_styleeditor_init.js]
 [browser_styleeditor_inline_friendly_names.js]
 [browser_styleeditor_loading.js]
 [browser_styleeditor_media_sidebar.js]
 [browser_styleeditor_media_sidebar_links.js]
+skip-if = e10s && debug && os == 'win' # Bug 1252201 - Docshell leak on win 7 debug e10s
 [browser_styleeditor_media_sidebar_sourcemaps.js]
 [browser_styleeditor_missing_stylesheet.js]
 [browser_styleeditor_navigate.js]
 [browser_styleeditor_new.js]
 [browser_styleeditor_nostyle.js]
 [browser_styleeditor_opentab.js]
 [browser_styleeditor_pretty.js]
 [browser_styleeditor_private_perwindowpb.js]