Bug 1246677 - 6 - Get rid of 'content' in ruleview head.js; r=tromey

MozReview-Commit-ID: A1r7oVz0cbV

--HG--
extra : rebase_source : 05612546b89c8e524c5f3248295b28f0781e7b3a
This commit is contained in:
Patrick Brosset 2016-02-15 10:22:06 +01:00
Родитель 26f78191e7
Коммит e8c1fc396b
7 изменённых файлов: 23 добавлений и 38 удалений

Просмотреть файл

@ -58,13 +58,13 @@ const TEST_URI = "<h1 style='font: 24px serif'>Header</h1>";
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {toolbox, inspector, view} = yield openRuleView();
let {toolbox, inspector, view, testActor} = yield openRuleView();
info("Test autocompletion after 1st page load");
yield runAutocompletionTest(toolbox, inspector, view);
info("Test autocompletion after page navigation");
yield reloadPage(inspector);
yield reloadPage(inspector, testActor);
yield runAutocompletionTest(toolbox, inspector, view);
});
@ -102,7 +102,7 @@ function* testCompletion([key, completion, index, total], editor, view) {
EventUtils.synthesizeKey(key, {}, view.styleWindow);
yield onSuggest;
yield wait(1); // Equivalent of executeSoon
yield waitForTick();
info("Checking the state");
if (completion != null) {

Просмотреть файл

@ -40,13 +40,13 @@ const TEST_URI = "<h1 style='color: red'>Header</h1>";
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {toolbox, inspector, view} = yield openRuleView();
let {toolbox, inspector, view, testActor} = yield openRuleView();
info("Test autocompletion after 1st page load");
yield runAutocompletionTest(toolbox, inspector, view);
info("Test autocompletion after page navigation");
yield reloadPage(inspector);
yield reloadPage(inspector, testActor);
yield runAutocompletionTest(toolbox, inspector, view);
});
@ -90,7 +90,7 @@ function* testCompletion([key, modifiers, completion, index, total], editor,
EventUtils.synthesizeKey(key, modifiers, view.styleWindow);
yield onKeyPress;
yield wait(1); // Equivalent of executeSoon
yield waitForTick();
// The key might have been a TAB or shift-TAB, in which case the editor will
// be a new one

Просмотреть файл

@ -41,13 +41,13 @@ const TEST_URI = "<h1 style='border: 1px solid red'>Header</h1>";
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {toolbox, inspector, view} = yield openRuleView();
let {toolbox, inspector, view, testActor} = yield openRuleView();
info("Test autocompletion after 1st page load");
yield runAutocompletionTest(toolbox, inspector, view);
info("Test autocompletion after page navigation");
yield reloadPage(inspector);
yield reloadPage(inspector, testActor);
yield runAutocompletionTest(toolbox, inspector, view);
});
@ -83,7 +83,7 @@ function* testCompletion([key, completion, index, total], editor, view) {
EventUtils.synthesizeKey(key, {}, view.styleWindow);
yield onSuggest;
yield wait(1); // Equivalent of executeSoon
yield waitForTick();
info("Checking the state");
if (completion != null) {

Просмотреть файл

@ -50,13 +50,13 @@ const TEST_URI = `
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {toolbox, inspector, view} = yield openRuleView();
let {toolbox, inspector, view, testActor} = yield openRuleView();
info("Test autocompletion after 1st page load");
yield runAutocompletionTest(toolbox, inspector, view);
info("Test autocompletion after page navigation");
yield reloadPage(inspector);
yield reloadPage(inspector, testActor);
yield runAutocompletionTest(toolbox, inspector, view);
});
@ -101,7 +101,7 @@ function* testCompletion([key, modifiers, completion, index, total], editor,
EventUtils.synthesizeKey(key, modifiers, view.styleWindow);
yield onKeyPress;
yield wait(1); // Equivalent of executeSoon
yield waitForTick();
info("Checking the state");
if (completion != null) {

Просмотреть файл

@ -10,7 +10,7 @@ const TEST_URI = "<h1 style='font: 24px serif'></h1>";
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
let {inspector, view, testActor} = yield openRuleView();
info("Test autocompletion popup is hidden after page navigation");
@ -28,12 +28,12 @@ add_task(function*() {
info("Waiting for autocomplete popup to be displayed");
yield onSuggest;
yield wait(1);
yield waitForTick();
ok(view.popup && view.popup.isOpen, "Popup should be opened");
info("Reloading the page");
yield reloadPage(inspector);
yield reloadPage(inspector, testActor);
ok(!(view.popup && view.popup.isOpen), "Popup should be closed");
});

Просмотреть файл

@ -14,7 +14,7 @@ const TEST_URI = `
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
let {inspector, view, testActor} = yield openRuleView();
yield selectNode("#id1", inspector);
yield modifyRuleViewWidth("300px", view, inspector);
@ -25,7 +25,7 @@ add_task(function*() {
yield modifyRuleViewWidth("50px", view, inspector);
yield assertRuleAndMarkupViewWidth("id2", "50px", view, inspector);
yield reloadPage(inspector);
yield reloadPage(inspector, testActor);
yield selectNode("#id1", inspector);
yield assertRuleAndMarkupViewWidth("id1", "200px", view, inspector);

Просмотреть файл

@ -110,20 +110,6 @@ function waitForNEvents(target, eventName, numTimes, useCapture = false) {
return deferred.promise;
}
/**
* This shouldn't be used in the tests, but is useful when writing new tests or
* debugging existing tests in order to introduce delays in the test steps
*
* @param {Number} ms
* The time to wait
* @return A promise that resolves when the time is passed
*/
function wait(ms) {
let def = promise.defer();
content.setTimeout(def.resolve, ms);
return def.promise;
}
/**
* Wait for a content -> chrome message on the message manager (the window
* messagemanager is used).
@ -750,15 +736,14 @@ var setSearchFilter = Task.async(function*(view, searchValue) {
*
* @param {InspectorPanel} inspector
* The instance of InspectorPanel currently loaded in the toolbox
* @return a promise that resolves after page reload and inspector
* initialization
* @param {TestActor} testActor
* The current instance of the TestActor
*/
function reloadPage(inspector) {
function* reloadPage(inspector, testActor) {
let onNewRoot = inspector.once("new-root");
content.location.reload();
return onNewRoot.then(() => {
inspector.markup._waitForChildren();
});
yield testActor.eval("content.location.reload();");
yield onNewRoot;
yield inspector.markup._waitForChildren();
}
/**