Bug 1034512 - Part 4: Make the output-parser test run in a toolbox host rather than content page. r=miker
authorPatrick Brosset <pbrosset@mozilla.com>
Mon, 26 Jan 2015 02:34:00 -0500
changeset 225829 a7384e567922e28a1b628871c507b9943e642a3f
parent 225828 5336ba11be5df1b985fed0f4c65e0f6466b12c61
child 225830 ce22415015105c37f032671e302730cb22c89668
push id28176
push userryanvm@gmail.com
push dateMon, 26 Jan 2015 21:48:45 +0000
treeherdermozilla-central@38e4719e71af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiker
bugs1034512
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 1034512 - Part 4: Make the output-parser test run in a toolbox host rather than content page. r=miker
browser/devtools/shared/test/browser.ini
browser/devtools/shared/test/browser_outputparser.js
--- a/browser/devtools/shared/test/browser.ini
+++ b/browser/devtools/shared/test/browser.ini
@@ -45,17 +45,19 @@ support-files =
 [browser_graphs-10b.js]
 [browser_graphs-11a.js]
 [browser_graphs-11b.js]
 [browser_graphs-12.js]
 [browser_graphs-13.js]
 [browser_graphs-14.js]
 [browser_inplace-editor.js]
 [browser_layoutHelpers.js]
+skip-if = e10s # Layouthelpers test should not run in a content page.
 [browser_layoutHelpers-getBoxQuads.js]
+skip-if = e10s # Layouthelpers test should not run in a content page.
 [browser_num-l10n.js]
 [browser_observableobject.js]
 [browser_outputparser.js]
 [browser_prefs.js]
 [browser_require_basic.js]
 [browser_spectrum.js]
 [browser_theme.js]
 [browser_tableWidget_basic.js]
--- a/browser/devtools/shared/test/browser_outputparser.js
+++ b/browser/devtools/shared/test/browser_outputparser.js
@@ -1,38 +1,35 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
 let {Loader} = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
 let {OutputParser} = devtools.require("devtools/output-parser");
 
-let parser;
-let doc;
-
-function test() {
-  waitForExplicitFinish();
+add_task(function*() {
+  yield promiseTab("about:blank");
+  yield performTest();
+  gBrowser.removeCurrentTab();
+});
 
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function onload() {
-    gBrowser.selectedBrowser.removeEventListener("load", onload, true);
-    waitForFocus(init, content);
-    doc = content.document;
-  }, true);
+function* performTest() {
+  let [host, win, doc] = yield createHost("bottom", "data:text/html," +
+    "<h1>browser_outputParser.js</h1><div></div>");
 
-  content.location = "data:text/html,<h1>browser_outputParser.js</h1>" +
-                     "<div></div>";
+  let parser = new OutputParser();
+  testParseCssProperty(doc, parser);
+  testParseCssVar(doc, parser);
+  testParseHTMLAttribute(doc, parser);
+  testParseNonCssHTMLAttribute(doc, parser);
+
+  host.destroy();
 }
 
-function init() {
-  parser = new OutputParser();
-  testParseCssProperty();
-}
-
-function testParseCssProperty() {
+function testParseCssProperty(doc, parser) {
   let frag = parser.parseCssProperty("border", "1px solid red", {
     colorSwatchClass: "test-colorswatch"
   });
 
   let target = doc.querySelector("div");
   ok(target, "captain, we have the div");
   target.appendChild(frag);
 
@@ -48,37 +45,33 @@ function testParseCssProperty() {
   });
   target.appendChild(frag);
   is(target.innerHTML,
      'linear-gradient(to right, <span data-color="#F60"><span style="background-color:#F60" class="test-colorswatch"></span><span class="test-color">#F60</span></span> 10%, ' +
      '<span data-color="#000"><span style="background-color:rgba(0,0,0,1)" class="test-colorswatch"></span><span class="test-color">#000</span></span>)',
      "Gradient CSS property correctly parsed");
 
   target.innerHTML = "";
-
-  testParseCssVar();
 }
 
-function testParseCssVar() {
+function testParseCssVar(doc, parser) {
   let frag = parser.parseCssProperty("color", "var(--some-kind-of-green)", {
     colorSwatchClass: "test-colorswatch"
   });
 
   let target = doc.querySelector("div");
   ok(target, "captain, we have the div");
   target.appendChild(frag);
 
   is(target.innerHTML, "var(--some-kind-of-green)", "CSS property correctly parsed");
 
   target.innerHTML = "";
-
-  testParseHTMLAttribute();
 }
 
-function testParseHTMLAttribute() {
+function testParseHTMLAttribute(doc, parser) {
   let attrib = "color:red; font-size: 12px; background-image: " +
                "url(chrome://branding/content/about-logo.png)";
   let frag = parser.parseHTMLAttribute(attrib, {
     urlClass: "theme-link",
     colorClass: "theme-color"
   });
 
   let target = doc.querySelector("div");
@@ -87,32 +80,23 @@ function testParseHTMLAttribute() {
 
   let expected = 'color:<span data-color="#F00"><span class="theme-color">#F00</span></span>; font-size: 12px; ' +
                  'background-image: url("<a href="chrome://branding/content/about-logo.png" ' +
                  'class="theme-link" ' +
                  'target="_blank">chrome://branding/content/about-logo.png</a>")';
 
   is(target.innerHTML, expected, "HTML Attribute correctly parsed");
   target.innerHTML = "";
-  testParseNonCssHTMLAttribute();
 }
 
-function testParseNonCssHTMLAttribute() {
+function testParseNonCssHTMLAttribute(doc, parser) {
   let attrib = "someclass background someotherclass red";
   let frag = parser.parseHTMLAttribute(attrib);
 
   let target = doc.querySelector("div");
   ok(target, "captain, we have the div");
   target.appendChild(frag);
 
   let expected = 'someclass background someotherclass red';
 
   is(target.innerHTML, expected, "Non-CSS HTML Attribute correctly parsed");
   target.innerHTML = "";
-  finishUp();
 }
-
-
-function finishUp() {
-  Services = Loader = OutputParser = parser = doc = null;
-  gBrowser.removeCurrentTab();
-  finish();
-}