--- a/devtools/client/inspector/layout/test/browser_layout.js
+++ b/devtools/client/inspector/layout/test/browser_layout.js
@@ -131,37 +131,38 @@ add_task(function*() {
"height: 100.111px; width: 100px; border: 10px solid black; " +
"padding: 20px; margin: 30px auto;}";
let html = "<style>" + style + "</style><div></div>";
yield addTab("data:text/html," + encodeURIComponent(html));
let {inspector, view, testActor} = yield openLayoutView();
yield selectNode("div", inspector);
- yield runTests(inspector, view, testActor);
+ yield testInitialValues(inspector, view);
+ yield testChangingValues(inspector, view, testActor);
});
-addTest("Test that the initial values of the box model are correct",
-function*(inspector, view) {
+function* testInitialValues(inspector, view) {
+ info("Test that the initial values of the box model are correct");
let viewdoc = view.doc;
for (let i = 0; i < res1.length; i++) {
let elt = viewdoc.querySelector(res1[i].selector);
is(elt.textContent, res1[i].value,
res1[i].selector + " has the right value.");
}
-});
+}
-addTest("Test that changing the document updates the box model",
-function*(inspector, view, testActor) {
+function* testChangingValues(inspector, view, testActor) {
+ info("Test that changing the document updates the box model");
let viewdoc = view.doc;
let onUpdated = waitForUpdate(inspector);
yield testActor.setAttribute("div", "style",
"height:150px;padding-right:50px;");
yield onUpdated;
for (let i = 0; i < res2.length; i++) {
let elt = viewdoc.querySelector(res2[i].selector);
is(elt.textContent, res2[i].value,
res2[i].selector + " has the right value after style update.");
}
-});
+}
--- a/devtools/client/inspector/layout/test/browser_layout_editablemodel.js
+++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel.js
@@ -20,23 +20,30 @@ const TEST_URI = "<style>" +
"<div id='div5'></div>";
function getStyle(node, property) {
return node.style.getPropertyValue(property);
}
add_task(function*() {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openLayoutView();
+ let {inspector, view} = yield openLayoutView();
- yield runTests(inspector, view);
+ yield testEditingMargins(inspector, view);
+ yield testKeyBindings(inspector, view);
+ yield testEscapeToUndo(inspector, view);
+ yield testDeletingValue(inspector, view);
+ yield testRefocusingOnClick(inspector, view);
+ yield testBluringOnClick(inspector, view);
});
-addTest("Test that editing margin dynamically updates the document, pressing escape cancels the changes",
-function*(inspector, view) {
+function* testEditingMargins(inspector, view) {
+ info("Test that editing margin dynamically updates the document, pressing " +
+ "escape cancels the changes");
+
let node = content.document.getElementById("div1");
is(getStyle(node, "margin-top"), "", "Should be no margin-top on the element.")
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-top > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@@ -49,20 +56,22 @@ function*(inspector, view) {
is(getStyle(node, "margin-top"), "3px", "Should have updated the margin.");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView);
yield waitForUpdate(inspector);
is(getStyle(node, "margin-top"), "", "Should be no margin-top on the element.")
is(span.textContent, 5, "Should have the right value in the box model.");
-});
+}
-addTest("Test that arrow keys work correctly and pressing enter commits the changes",
-function*(inspector, view) {
+function* testKeyBindings(inspector, view) {
+ info("Test that arrow keys work correctly and pressing enter commits the " +
+ "changes");
+
let node = content.document.getElementById("div1");
is(getStyle(node, "margin-left"), "", "Should be no margin-top on the element.")
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-left > span");
is(span.textContent, 10, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@@ -86,20 +95,22 @@ function*(inspector, view) {
yield waitForUpdate(inspector);
is(editor.value, "20px", "Should have the right value in the editor.");
is(getStyle(node, "margin-left"), "20px", "Should have updated the margin.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "margin-left"), "20px", "Should be the right margin-top on the element.")
is(span.textContent, 20, "Should have the right value in the box model.");
-});
+}
-addTest("Test that deleting the value removes the property but escape undoes that",
-function*(inspector, view) {
+function* testEscapeToUndo(inspector, view) {
+ info("Test that deleting the value removes the property but escape undoes " +
+ "that");
+
let node = content.document.getElementById("div1");
is(getStyle(node, "margin-left"), "20px", "Should be the right margin-top on the element.")
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-left > span");
is(span.textContent, 20, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@@ -113,20 +124,21 @@ function*(inspector, view) {
is(editor.value, "", "Should have the right value in the editor.");
is(getStyle(node, "margin-left"), "", "Should have updated the margin.");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView);
yield waitForUpdate(inspector);
is(getStyle(node, "margin-left"), "20px", "Should be the right margin-top on the element.")
is(span.textContent, 20, "Should have the right value in the box model.");
-});
+}
-addTest("Test that deleting the value removes the property",
-function*(inspector, view) {
+function* testDeletingValue(inspector, view) {
+ info("Test that deleting the value removes the property");
+
let node = content.document.getElementById("div1");
node.style.marginRight = "15px";
yield waitForUpdate(inspector);
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-right > span");
@@ -142,20 +154,21 @@ function*(inspector, view) {
is(editor.value, "", "Should have the right value in the editor.");
is(getStyle(node, "margin-right"), "", "Should have updated the margin.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "margin-right"), "", "Should be the right margin-top on the element.")
is(span.textContent, 10, "Should have the right value in the box model.");
-});
+}
-addTest("Test that clicking in the editor input does not remove focus",
-function*(inspector, view) {
+function* testRefocusingOnClick(inspector, view) {
+ info("Test that clicking in the editor input does not remove focus");
+
let node = content.document.getElementById("div4");
yield selectNode("#div4", inspector);
let span = view.doc.querySelector(".layout-margin.layout-top > span");
is(span.textContent, 1, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@@ -173,20 +186,21 @@ function*(inspector, view) {
is(editor.value, "2px", "Should have the right value in the editor.");
is(getStyle(node, "margin-top"), "2px", "Should have updated the margin.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "margin-top"), "2px",
"Should be the right margin-top on the element.");
is(span.textContent, 2, "Should have the right value in the box model.");
-});
+}
-addTest("Test that clicking outside the editor blurs it",
-function*(inspector, view) {
+function* testBluringOnClick(inspector, view) {
+ info("Test that clicking outside the editor blurs it");
+
let node = content.document.getElementById("div5");
yield selectNode("#div5", inspector);
let span = view.doc.querySelector(".layout-margin.layout-top > span");
is(span.textContent, 1, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@@ -195,9 +209,9 @@ function*(inspector, view) {
info("Click next to the opened editor input.");
let rect = editor.getBoundingClientRect();
EventUtils.synthesizeMouse(editor, rect.width + 10, rect.height / 2, {},
view.doc.defaultView);
is(view.doc.querySelector(".styleinspector-propertyeditor"), null,
"Inplace editor has been removed.");
-});
+}
--- a/devtools/client/inspector/layout/test/browser_layout_editablemodel_allproperties.js
+++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel_allproperties.js
@@ -15,23 +15,27 @@ const TEST_URI = "<style>" +
"<div id='div1'></div><div id='div2'></div><div id='div3'></div>";
function getStyle(node, property) {
return node.style.getPropertyValue(property);
}
add_task(function*() {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openLayoutView();
+ let {inspector, view} = yield openLayoutView();
- yield runTests(inspector, view);
+ yield testEditing(inspector, view);
+ yield testEditingAndCanceling(inspector, view);
+ yield testDeleting(inspector, view);
+ yield testDeletingAndCanceling(inspector, view);
});
-addTest("When all properties are set on the node editing one should work",
-function*(inspector, view) {
+function* testEditing(inspector, view) {
+ info("When all properties are set on the node editing one should work");
+
let node = content.document.getElementById("div1");
node.style.padding = "5px";
yield waitForUpdate(inspector);
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-bottom > span");
@@ -47,20 +51,22 @@ function*(inspector, view) {
is(editor.value, "7", "Should have the right value in the editor.");
is(getStyle(node, "padding-bottom"), "7px", "Should have updated the padding");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "padding-bottom"), "7px", "Should be the right padding.")
is(span.textContent, 7, "Should have the right value in the box model.");
-});
+}
-addTest("When all properties are set on the node editing one should work",
-function*(inspector, view) {
+function* testEditingAndCanceling(inspector, view) {
+ info("When all properties are set on the node editing one and then " +
+ "cancelling with ESCAPE should work");
+
let node = content.document.getElementById("div1");
node.style.padding = "5px";
yield waitForUpdate(inspector);
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-left > span");
@@ -77,20 +83,21 @@ function*(inspector, view) {
is(editor.value, "8", "Should have the right value in the editor.");
is(getStyle(node, "padding-left"), "8px", "Should have updated the padding");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView);
yield waitForUpdate(inspector);
is(getStyle(node, "padding-left"), "5px", "Should be the right padding.")
is(span.textContent, 5, "Should have the right value in the box model.");
-});
+}
-addTest("When all properties are set on the node deleting one should work",
-function*(inspector, view) {
+function* testDeleting(inspector, view) {
+ info("When all properties are set on the node deleting one should work");
+
let node = content.document.getElementById("div1");
node.style.padding = "5px";
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
@@ -105,20 +112,22 @@ function*(inspector, view) {
is(editor.value, "", "Should have the right value in the editor.");
is(getStyle(node, "padding-left"), "", "Should have updated the padding");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "padding-left"), "", "Should be the right padding.")
is(span.textContent, 3, "Should have the right value in the box model.");
-});
+}
-addTest("When all properties are set on the node deleting one then cancelling should work",
-function*(inspector, view) {
+function* testDeletingAndCanceling(inspector, view) {
+ info("When all properties are set on the node deleting one then cancelling " +
+ "should work");
+
let node = content.document.getElementById("div1");
node.style.padding = "5px";
yield waitForUpdate(inspector);
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-left > span");
@@ -135,9 +144,9 @@ function*(inspector, view) {
is(editor.value, "", "Should have the right value in the editor.");
is(getStyle(node, "padding-left"), "", "Should have updated the padding");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView);
yield waitForUpdate(inspector);
is(getStyle(node, "padding-left"), "5px", "Should be the right padding.")
is(span.textContent, 5, "Should have the right value in the box model.");
-});
+}
--- a/devtools/client/inspector/layout/test/browser_layout_editablemodel_border.js
+++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel_border.js
@@ -15,17 +15,17 @@ const TEST_URI = "<style>" +
"<div id='div1'></div><div id='div2'></div><div id='div3'></div>";
function getStyle(node, property) {
return node.style.getPropertyValue(property);
}
add_task(function*() {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openLayoutView();
+ let {inspector, view} = yield openLayoutView();
let node = content.document.getElementById("div1");
is(getStyle(node, "border-top-width"), "", "Should have the right border");
is(getStyle(node, "border-top-style"), "", "Should have the right border");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-border.layout-top > span");
is(span.textContent, 0, "Should have the right value in the box model.");
--- a/devtools/client/inspector/layout/test/browser_layout_editablemodel_stylerules.js
+++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel_stylerules.js
@@ -16,23 +16,26 @@ const TEST_URI = "<style>" +
"<div id='div1'></div><div id='div2'></div><div id='div3'></div>";
function getStyle(node, property) {
return node.style.getPropertyValue(property);
}
add_task(function*() {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openLayoutView();
+ let {inspector, view} = yield openLayoutView();
- yield runTests(inspector, view);
+ yield testUnits(inspector, view);
+ yield testValueComesFromStyleRule(inspector, view);
+ yield testShorthandsAreParsed(inspector, view);
});
-addTest("Test that entering units works",
-function*(inspector, view) {
+function* testUnits(inspector, view) {
+ info("Test that entering units works");
+
let node = content.document.getElementById("div1");
is(getStyle(node, "padding-top"), "", "Should have the right padding");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-top > span");
is(span.textContent, 3, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@@ -52,55 +55,60 @@ function*(inspector, view) {
is(editor.value, "1em", "Should have the right value in the editor.");
is(getStyle(node, "padding-top"), "1em", "Should have updated the padding.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "padding-top"), "1em", "Should be the right padding.")
is(span.textContent, 16, "Should have the right value in the box model.");
-});
+}
-addTest("Test that we pick up the value from a higher style rule",
-function*(inspector, view) {
+function* testValueComesFromStyleRule(inspector, view) {
+ info("Test that we pick up the value from a higher style rule");
+
let node = content.document.getElementById("div2");
- is(getStyle(node, "border-bottom-width"), "", "Should have the right border-bottom-width");
+ is(getStyle(node, "border-bottom-width"), "",
+ "Should have the right border-bottom-width");
yield selectNode("#div2", inspector);
let span = view.doc.querySelector(".layout-border.layout-bottom > span");
is(span.textContent, 16, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
let editor = view.doc.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "1em", "Should have the right value in the editor.");
EventUtils.synthesizeKey("0", {}, view.doc.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "0", "Should have the right value in the editor.");
- is(getStyle(node, "border-bottom-width"), "0px", "Should have updated the border.");
+ is(getStyle(node, "border-bottom-width"), "0px",
+ "Should have updated the border.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
- is(getStyle(node, "border-bottom-width"), "0px", "Should be the right border-bottom-width.")
+ is(getStyle(node, "border-bottom-width"), "0px",
+ "Should be the right border-bottom-width.");
is(span.textContent, 0, "Should have the right value in the box model.");
-});
+}
-addTest("Test that shorthand properties are parsed correctly",
-function*(inspector, view) {
+function* testShorthandsAreParsed(inspector, view) {
+ info("Test that shorthand properties are parsed correctly");
+
let node = content.document.getElementById("div3");
is(getStyle(node, "padding-right"), "", "Should have the right padding");
yield selectNode("#div3", inspector);
let span = view.doc.querySelector(".layout-padding.layout-right > span");
is(span.textContent, 32, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
let editor = view.doc.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "2em", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
is(getStyle(node, "padding-right"), "", "Should be the right padding.")
is(span.textContent, 32, "Should have the right value in the box model.");
-});
+}
--- a/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js
+++ b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js
@@ -4,89 +4,93 @@
"use strict";
// Test that the layout-view continues to work after a page navigation and that
// it also works after going back
add_task(function*() {
yield addTab(URL_ROOT + "doc_layout_iframe1.html");
- let {toolbox, inspector, view} = yield openLayoutView();
- yield runTests(inspector, view);
+ let {inspector, view} = yield openLayoutView();
+
+ yield testFirstPage(inspector, view);
+
+ info("Navigate to the second page");
+ yield navigateTo(URL_ROOT + "doc_layout_iframe2.html");
+ yield inspector.once("markuploaded");
+
+ yield testSecondPage(inspector, view);
+
+ info("Go back to the first page");
+ content.history.back();
+ yield inspector.once("markuploaded");
+
+ yield testBackToFirstPage(inspector, view);
});
-addTest("Test that the layout-view works on the first page",
-function*(inspector, view) {
+function* testFirstPage(inspector, view) {
+ info("Test that the layout-view works on the first page");
+
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value");
let paddingElt = view.doc.querySelector(".layout-padding.layout-top > span");
is(paddingElt.textContent, "50");
info("Listening for layout-view changes and modifying the padding");
let onUpdated = waitForUpdate(inspector);
getNode("p").style.padding = "20px";
yield onUpdated;
ok(true, "Layout-view got updated");
info("Checking that the layout-view shows the right value after update");
is(paddingElt.textContent, "20");
-});
+}
-addTest("Navigate to the second page",
-function*(inspector, view) {
- yield navigateTo(URL_ROOT + "doc_layout_iframe2.html");
- yield inspector.once("markuploaded");
-});
+function* testSecondPage(inspector, view) {
+ info("Test that the layout-view works on the second page");
-addTest("Test that the layout-view works on the second page",
-function*(inspector, view) {
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value");
let sizeElt = view.doc.querySelector(".layout-size > span");
is(sizeElt.textContent, "100" + "\u00D7" + "100");
info("Listening for layout-view changes and modifying the size");
let onUpdated = waitForUpdate(inspector);
getNode("p").style.width = "200px";
yield onUpdated;
ok(true, "Layout-view got updated");
info("Checking that the layout-view shows the right value after update");
is(sizeElt.textContent, "200" + "\u00D7" + "100");
-});
+}
-addTest("Go back to the first page",
-function*(inspector, view) {
- content.history.back();
- yield inspector.once("markuploaded");
-});
+function* testBackToFirstPage(inspector, view) {
+ info("Test that the layout-view works on the first page after going back");
-addTest("Test that the layout-view works on the first page after going back",
-function*(inspector, view) {
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value, which is the" +
"modified value from step one because of the bfcache");
let paddingElt = view.doc.querySelector(".layout-padding.layout-top > span");
is(paddingElt.textContent, "20");
info("Listening for layout-view changes and modifying the padding");
let onUpdated = waitForUpdate(inspector);
getNode("p").style.padding = "100px";
yield onUpdated;
ok(true, "Layout-view got updated");
info("Checking that the layout-view shows the right value after update");
is(paddingElt.textContent, "100");
-});
+}
function navigateTo(url) {
info("Navigating to " + url);
let def = promise.defer();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
info("URL " + url + " loading complete");
--- a/devtools/client/inspector/layout/test/browser_layout_update-in-iframes.js
+++ b/devtools/client/inspector/layout/test/browser_layout_update-in-iframes.js
@@ -6,42 +6,46 @@
// Test that the layout-view for elements within iframes also updates when they
// change
add_task(function*() {
yield addTab(URL_ROOT + "doc_layout_iframe1.html");
let iframe2 = getNode("iframe").contentDocument.querySelector("iframe");
- let {toolbox, inspector, view} = yield openLayoutView();
- yield runTests(inspector, view, iframe2);
+ let {inspector, view} = yield openLayoutView();
+ yield testResizingInIframe(inspector, view, iframe2);
+ yield testReflowsAfterIframeDeletion(inspector, view, iframe2);
});
-addTest("Test that resizing an element in an iframe updates its box model",
-function*(inspector, view, iframe2) {
+function* testResizingInIframe(inspector, view, iframe2) {
+ info("Test that resizing an element in an iframe updates its box model");
+
info("Selecting the nested test node");
let node = iframe2.contentDocument.querySelector("div");
yield selectNodeInIframe2("div", inspector);
info("Checking that the layout-view shows the right value");
let sizeElt = view.doc.querySelector(".layout-size > span");
is(sizeElt.textContent, "400\u00D7200");
info("Listening for layout-view changes and modifying its size");
let onUpdated = waitForUpdate(inspector);
node.style.width = "200px";
yield onUpdated;
ok(true, "Layout-view got updated");
info("Checking that the layout-view shows the right value after update");
is(sizeElt.textContent, "200\u00D7200");
-});
+}
-addTest("Test reflows are still sent to the layout-view after deleting an iframe",
-function*(inspector, view, iframe2) {
+function* testReflowsAfterIframeDeletion(inspector, view, iframe2) {
+ info("Test reflows are still sent to the layout-view after deleting an " +
+ "iframe");
+
info("Deleting the iframe2");
iframe2.remove();
yield inspector.once("inspector-updated");
info("Selecting the test node in iframe1");
let node = getNode("iframe").contentDocument.querySelector("p");
yield selectNodeInIframe1("p", inspector);
@@ -52,17 +56,17 @@ function*(inspector, view, iframe2) {
info("Listening for layout-view changes and modifying its size");
let onUpdated = waitForUpdate(inspector);
node.style.width = "200px";
yield onUpdated;
ok(true, "Layout-view got updated");
info("Checking that the layout-view shows the right value after update");
is(sizeElt.textContent, "200\u00D7100");
-});
+}
function* selectNodeInIframe1(selector, inspector) {
let iframe1 = yield getNodeFront("iframe", inspector);
let node = yield getNodeFrontInFrame(selector, iframe1, inspector);
yield selectNode(node, inspector);
}
function* selectNodeInIframe2(selector, inspector) {
--- a/devtools/client/inspector/layout/test/head.js
+++ b/devtools/client/inspector/layout/test/head.js
@@ -76,33 +76,8 @@ function openLayoutView() {
/**
* Wait for the layoutview-updated event.
* @return a promise
*/
function waitForUpdate(inspector) {
return inspector.once("layoutview-updated");
}
-
-/**
- * The addTest/runTests function couple provides a simple way to define
- * subsequent test cases in a test file. Example:
- *
- * addTest("what this test does", function*() {
- * ... actual code for the test ...
- * });
- * addTest("what this second test does", function*() {
- * ... actual code for the second test ...
- * });
- * runTests().then(...);
- */
-var TESTS = [];
-
-function addTest(message, func) {
- TESTS.push([message, Task.async(func)]);
-}
-
-var runTests = Task.async(function*(...args) {
- for (let [message, test] of TESTS) {
- info("Running new test case: " + message);
- yield test.apply(null, args);
- }
-});