Bug 1181837 - 8 - Include inspector's head.js in markup view to remove duplication; r=bgrins

This commit is contained in:
Patrick Brosset 2016-01-20 09:42:16 +01:00
parent d98e0edcb7
commit a46c93e49a
75 changed files with 274 additions and 471 deletions

View File

@ -5,10 +5,10 @@
"use strict";
// Test native anonymous content in the markupview.
const TEST_URL = TEST_URL_ROOT + "doc_markup_anonymous.html";
const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let pseudo = yield getNodeFront("#pseudo", inspector);

View File

@ -10,7 +10,7 @@ requestLongerTimeout(2);
const TEST_URL = "chrome://devtools/content/scratchpad/scratchpad.xul";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let toolbarbutton = yield getNodeFront("toolbarbutton", inspector);
let children = yield inspector.walker.children(toolbarbutton);

View File

@ -7,12 +7,12 @@
// Test shadow DOM content in the markupview.
// Note that many features are not yet enabled, but basic listing
// of elements should be working.
const TEST_URL = TEST_URL_ROOT + "doc_markup_anonymous.html";
const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";
add_task(function*() {
Services.prefs.setBoolPref("dom.webcomponents.enabled", true);
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let shadow = yield getNodeFront("#shadow", inspector.markup);
let children = yield inspector.walker.children(shadow);

View File

@ -6,12 +6,12 @@
// Test native anonymous content in the markupview with devtools.inspector.showAllAnonymousContent
// set to true
const TEST_URL = TEST_URL_ROOT + "doc_markup_anonymous.html";
const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";
add_task(function*() {
Services.prefs.setBoolPref("devtools.inspector.showAllAnonymousContent", true);
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let native = yield getNodeFront("#native", inspector);

View File

@ -12,7 +12,7 @@
// The correctness and cycling of the suggestions is covered in the ruleview
// tests.
const TEST_URL = TEST_URL_ROOT + "doc_markup_edit.html";
const TEST_URL = URL_ROOT + "doc_markup_edit.html";
// test data format :
// [
// what key to press,
@ -65,7 +65,7 @@ const TEST_DATA = [
add_task(function*() {
info("Opening the inspector on the test URL");
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
yield inspector.markup.expandAll();

View File

@ -7,10 +7,10 @@
// Test that dragging a node near the top or bottom edge of the markup-view
// auto-scrolls the view.
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop_autoscroll.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let markup = inspector.markup;
let viewHeight = markup.doc.documentElement.clientHeight;

View File

@ -8,14 +8,14 @@
// the minimum vertical distance defined in markup-view.js by
// DRAG_DROP_MIN_INITIAL_DISTANCE.
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
const TEST_NODE = "#test";
// Keep this in sync with DRAG_DROP_MIN_INITIAL_DISTANCE in markup-view.js
const MIN_DISTANCE = 10;
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Drag the test node by half of the minimum distance");
yield simulateNodeDrag(inspector, TEST_NODE, 0, MIN_DISTANCE / 2);

View File

@ -6,11 +6,11 @@
// Test that the root node isn't draggable (as well as head and body).
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
const TEST_DATA = ["html", "head", "body"];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
for (let selector of TEST_DATA) {
info("Try to drag/drop node " + selector);

View File

@ -6,10 +6,10 @@
// Test whether ESCAPE keypress cancels dragging of an element.
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let {markup} = inspector;
info("Get a test container");

View File

@ -6,12 +6,12 @@
// Check that pseudo-elements and anonymous nodes are not draggable.
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
add_task(function*() {
Services.prefs.setBoolPref("devtools.inspector.showAllAnonymousContent", true);
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Expanding nodes below #test");
let parentFront = yield getNodeFront("#test", inspector);

View File

@ -8,10 +8,10 @@ requestLongerTimeout(2);
// Test different kinds of drag and drop node re-ordering.
const TEST_URL = TEST_URL_ROOT + "doc_markup_dragdrop.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let ids;
info("Expand #test node");

View File

@ -5,7 +5,7 @@
const TEST_URL = "data:text/html;charset=utf8,<img src=\"about:logo\" /><div>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let {markup} = inspector;
info("Get the tooltip target element for the image's src attribute");

View File

@ -3,7 +3,7 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events-overflow.html";
const TEST_URL = URL_ROOT + "doc_markup_events-overflow.html";
const TEST_DATA = [
{
desc: "editor overflows container",
@ -29,7 +29,7 @@ const TEST_DATA = [
];
add_task(function*() {
let { inspector } = yield addTab(TEST_URL).then(openInspector);
let { inspector } = yield openInspectorForURL(TEST_URL);
let markupContainer = yield getContainerForSelector("#events", inspector);
let evHolder = markupContainer.elt.querySelector(".markupview-events");

View File

@ -7,7 +7,7 @@
// Test that markup view event bubbles show the correct event info for DOM
// events.
const TEST_URL = TEST_URL_ROOT + "doc_markup_events.html";
const TEST_URL = URL_ROOT + "doc_markup_events.html";
loadHelperScript("helper_events_test_runner.js");

View File

@ -9,16 +9,16 @@
// The test registers one backend actor providing custom form data
// and checks that the value is properly sent to the client (NodeFront).
const TEST_PAGE_URL = TEST_URL_ROOT + "doc_markup_events_form.html";
const TEST_ACTOR_URL = CHROME_BASE + "actor_events_form.js";
const TEST_PAGE_URL = URL_ROOT + "doc_markup_events_form.html";
const TEST_ACTOR_URL = CHROME_URL_ROOT + "actor_events_form.js";
var {ActorRegistryFront} = require("devtools/server/actors/actor-registry");
var {EventsFormFront} = require(TEST_ACTOR_URL);
add_task(function*() {
info("Opening the Toolbox");
let {tab} = yield addTab(TEST_PAGE_URL);
let {toolbox} = yield openToolbox("webconsole");
let tab = yield addTab(TEST_PAGE_URL);
let toolbox = yield openToolboxForTab(tab, "webconsole");
info("Registering test actor");
let {registrar, front} = yield registerTestActor(toolbox);

View File

@ -8,7 +8,7 @@
// and jQuery Live events (jQuery version 1.0).
const TEST_LIB = "lib_jquery_1.0.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB,
filename: URL_ROOT + TEST_LIB,
attributes: [
"jQuery"
],
@ -104,7 +104,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB,
filename: URL_ROOT + TEST_LIB,
attributes: [
"Bubbling",
"DOM0"
@ -159,7 +159,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":894",
filename: URL_ROOT + TEST_LIB + ":894",
attributes: [
"Bubbling",
"DOM2"
@ -199,7 +199,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":894",
filename: URL_ROOT + TEST_LIB + ":894",
attributes: [
"Bubbling",
"DOM2"

View File

@ -8,7 +8,7 @@
// and jQuery Live events (jQuery version 1.1).
const TEST_LIB = "lib_jquery_1.1.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB,
filename: URL_ROOT + TEST_LIB,
attributes: [
"jQuery"
],
@ -108,7 +108,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB,
filename: URL_ROOT + TEST_LIB,
attributes: [
"Bubbling",
"DOM0"
@ -173,7 +173,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":1224",
filename: URL_ROOT + TEST_LIB + ":1224",
attributes: [
"Bubbling",
"DOM2"
@ -223,7 +223,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":1224",
filename: URL_ROOT + TEST_LIB + ":1224",
attributes: [
"Bubbling",
"DOM2"

View File

@ -8,7 +8,7 @@
// and jQuery Live events (jQuery version 1.11.1).
const TEST_LIB = "lib_jquery_1.11.1_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -105,7 +105,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":3",
filename: URL_ROOT + TEST_LIB + ":3",
attributes: [
"Bubbling",
"DOM2"
@ -126,7 +126,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":3",
filename: URL_ROOT + TEST_LIB + ":3",
attributes: [
"Bubbling",
"DOM2"

View File

@ -8,7 +8,7 @@
// and jQuery Live events (jQuery version 1.2).
const TEST_LIB = "lib_jquery_1.2_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -79,7 +79,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB,
filename: URL_ROOT + TEST_LIB,
attributes: [
"Bubbling",
"DOM0"
@ -144,7 +144,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":24",
filename: URL_ROOT + TEST_LIB + ":24",
attributes: [
"Bubbling",
"DOM2"
@ -168,7 +168,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":24",
filename: URL_ROOT + TEST_LIB + ":24",
attributes: [
"Bubbling",
"DOM2"

View File

@ -8,7 +8,7 @@
// and jQuery Live events (jQuery version 1.3).
const TEST_LIB = "lib_jquery_1.3_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"jQuery"
],
@ -98,7 +98,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"Bubbling",
"DOM2"
@ -109,7 +109,7 @@ const TEST_DATA = [
},
{
type: "unload",
filename: TEST_URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"jQuery"
],
@ -120,7 +120,7 @@ const TEST_DATA = [
},
{
type: "unload",
filename: TEST_URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"Bubbling",
"DOM2"
@ -156,7 +156,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"Bubbling",
"DOM2"
@ -177,7 +177,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"Bubbling",
"DOM2"

View File

@ -8,7 +8,7 @@
// and jQuery Live events (jQuery version 1.4).
const TEST_LIB = "lib_jquery_1.4_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -79,7 +79,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB + ":26",
filename: URL_ROOT + TEST_LIB + ":26",
attributes: [
"Bubbling",
"DOM2"
@ -123,7 +123,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":48",
filename: URL_ROOT + TEST_LIB + ":48",
attributes: [
"Bubbling",
"DOM2"
@ -144,7 +144,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":48",
filename: URL_ROOT + TEST_LIB + ":48",
attributes: [
"Bubbling",
"DOM2"
@ -171,7 +171,7 @@ const TEST_DATA = [
},
{
type: "dblclick",
filename: TEST_URL_ROOT + TEST_LIB + ":17",
filename: URL_ROOT + TEST_LIB + ":17",
attributes: [
"jQuery",
"Live"
@ -230,7 +230,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: TEST_URL_ROOT + TEST_LIB + ":17",
filename: URL_ROOT + TEST_LIB + ":17",
attributes: [
"jQuery",
"Live"

View File

@ -10,7 +10,7 @@ requestLongerTimeout(2);
// and jQuery Live events (jQuery version 1.6).
const TEST_LIB = "lib_jquery_1.6_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -81,7 +81,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"Bubbling",
"DOM2"
@ -122,7 +122,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"Bubbling",
"DOM2"
@ -143,7 +143,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"Bubbling",
"DOM2"
@ -170,7 +170,7 @@ const TEST_DATA = [
},
{
type: "dblclick",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"jQuery",
"Live"
@ -225,7 +225,7 @@ const TEST_DATA = [
},
{
type: "dragend",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"jQuery",
"Live"
@ -280,7 +280,7 @@ const TEST_DATA = [
},
{
type: "dragleave",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"jQuery",
"Live"
@ -335,7 +335,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: TEST_URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16",
attributes: [
"jQuery",
"Live"

View File

@ -10,7 +10,7 @@ requestLongerTimeout(2);
// and jQuery Live events (jQuery version 1.7).
const TEST_LIB = "lib_jquery_1.7_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -81,7 +81,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL_ROOT + TEST_LIB + ":2",
filename: URL_ROOT + TEST_LIB + ":2",
attributes: [
"Bubbling",
"DOM2"
@ -122,7 +122,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":3",
filename: URL_ROOT + TEST_LIB + ":3",
attributes: [
"Bubbling",
"DOM2"
@ -143,7 +143,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":3",
filename: URL_ROOT + TEST_LIB + ":3",
attributes: [
"Bubbling",
"DOM2"

View File

@ -10,7 +10,7 @@ requestLongerTimeout(2);
// and jQuery Live events (jQuery version 2.1.1).
const TEST_LIB = "lib_jquery_2.1.1_min.js";
const TEST_URL = TEST_URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
const TEST_URL = URL_ROOT + "doc_markup_events_jquery.html?" + TEST_LIB;
loadHelperScript("helper_events_test_runner.js");
@ -106,7 +106,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL_ROOT + TEST_LIB + ":3",
filename: URL_ROOT + TEST_LIB + ":3",
attributes: [
"Bubbling",
"DOM2"
@ -127,7 +127,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL_ROOT + TEST_LIB + ":3",
filename: URL_ROOT + TEST_LIB + ":3",
attributes: [
"Bubbling",
"DOM2"

View File

@ -15,7 +15,7 @@ const TEST_DATA = [
newHTML: '<div id="one">First Div</div>',
validate: function*(pageNode, pageNodeFront, selectedNodeFront) {
is(pageNode.textContent, "First Div", "New div has expected text content");
ok(!getNode("#one em"), "No em remaining")
ok(!getNode("#one em", {expectNoMatch: true}), "No em remaining")
}
},
{
@ -71,7 +71,7 @@ const TEST_URL = "data:text/html," +
"</html>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
inspector.markup._frame.focus();
yield runEditOuterHTMLTests(TEST_DATA, inspector);
yield runEditOuterHTMLTests(TEST_DATA, inspector, testActor);
});

View File

@ -74,7 +74,7 @@ const TEST_DATA = [
is(pageNodeFront, selectedNodeFront, "Original element is selected");
let p = getNode("#badMarkup5");
let nodiv = getNode("#badMarkup5 div");
let nodiv = getNode("#badMarkup5 div", {expectNoMatch: true});
let div = getNode("#badMarkup5 ~ div");
ok(!nodiv, "The invalid markup got created as a sibling");
@ -95,7 +95,7 @@ const TEST_URL = "data:text/html," +
"</html>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
inspector.markup._frame.focus();
yield runEditOuterHTMLTests(TEST_DATA, inspector);
yield runEditOuterHTMLTests(TEST_DATA, inspector, testActor);
});

View File

@ -21,7 +21,7 @@ const NEW_HTML = '<div id="keyboard">Edited</div>';
requestLongerTimeout(2);
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
inspector.markup._frame.focus();

View File

@ -11,7 +11,7 @@
const PAGE_CONTENT = [
'<img class="local" src="chrome://branding/content/about-logo.png" />',
'<img class="data" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADI5JREFUeNrsWwuQFNUVPf1m5z87szv7HWSWj8CigBFMEFZKiQsB1PgJwUAZg1HBpIQsKmokEhNjWUn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SgoOo2mwVukb98D5EqpswZTTulCggTk4gpYhv0++wIhCJxr0+Hq1sondis0SE2oxQe3qWXwWyO4DSQg9gJ8Iiw1VFcGqXxet0N9xE4ygIxv/9W6wo9WyROEX/R+eiobYSq2vHTOR631Eiv2lRfh9dvxkumkXh92Qsx8XrAJ+7YGbWuhxOi/U+31NQmzyqNYG8N/3wfo6CRtRHcN01FzkvojohwLu0VVvDa56IS/xcj2b7nN+O+m0jqpE1wMPXZxAN9iCVThtDvH7gmiRGRpU8Lspv1Uhq4wIVdQoyuGSLNYPKUCS8+CzNURbzMmjK3i8u0U793lmuV0ef9nWQ5MGC/DiUqEUSaCtXna9RJEspZS1lrXINK/pcq+SpT50t98QKMq1FRmDfx3vxty102k0PM4ssEnvuz5+G26Ij4yDpz6z9fV8bkyIkqBFkhej0Ib+ZQ34XJK9AfozaiimqIoX3Jp3tiISrcfYpuN2+iFph/02P36PNC9fVcCnp6H9jYouKyfaWufz5Tp9tVxcUniw7IohZv4dZz81/ns67z3AYPrc2n0+Ix2q8k0PWjgBy88XaibnfK9A+5LdDY2Ivhy36fbT8Zv3Lb1U1qLqUxorXEEXIs0mjjrtxoTZWtdvigNs2sgPiujTv6DIZLld6b/V5742JZV3fUsUVFy5gdsNtKWFzUCEVbNepD1MkSMVbsb6SZm7jI3/zODtQKgUMsOw8wDZ63t5xcV1TnaEAxoc6wrqY+Fj+N4DsqOnhOIdicrQSm1MPYCPlIqHn5bbHg8/bj2D3QfZnCX3mpAICDZV8jH5kpbZqTD0W+DxaA74CWzLN2nd14OlL72J38Lf7+TjC7dadZFDoZJQPrtaIKL/G0L6ktptPZVJ8fMqHYPZOKYPMyQGadIJfDvdXwAFiZOTvDBPydf5vk4rWA+RfdhBlaF/yDDBRoMu9pfnSjv/p7DG+HXfAcQcc49v/BBgAcFAO4DmB2GQAAAAASUVORK5CYII=" />',
'<img class="remote" src="' + TEST_URL_ROOT + 'doc_markup_tooltip.png" />',
'<img class="remote" src="' + URL_ROOT + 'doc_markup_tooltip.png" />',
'<canvas class="canvas" width="600" height="600"></canvas>'
].join("\n");

View File

@ -8,15 +8,14 @@
// changes.
const INITIAL_SRC = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADI5JREFUeNrsWwuQFNUVPf1m5z87szv7HWSWj8CigBFMEFZKiQsB1PgJwUAZg1HBpIQsKmokEhNjWUnFVPnDWBT+KolJYbRMoqUVq0yCClpqiX8sCchPWFwVlt2db7+X93pez7zu6Vn2NxsVWh8987p7pu+9555z7+tZjTGGY3kjOMa34w447oBjfKsY7i/UNM3Y8eFSAkD50Plgw03K5P9gvGv7U5ieeR3PszeREiPNX3/0DL4hjslzhm8THh+OITfXk3dhiv4GDtGPVzCaeJmPLYzuu5qJuWfuw2QTlcN1X9pwQU7LhdZ/ZAseD45cOh9hHvDkc/yAF/DNhdb5Mrr3PvBMaAYW8fMSIi2G497IMEK/YutGtAYr6+ej+nxu/NN8Ks3N7AR6HgcLz0Eg1Ljg1UcxZzi5qewIkMYLRweTr2Kzp+nmyXAd5pS3XQDd+N/4h4zgu9FI7brlXf90nMEnuwQxlvv+hosE3TuexmWeysmT4W+WxkMaLzf9Y8ATgjcUn7T9H1gqrpFq8eV1gMn6t16NhngjfoX6q4DUP032Rd4LJgpSLwJ1yzFqBG69eRkah0MVyo0Acfe+yy9AG4nMiYCkeM53KKFXncBLAXqEm+wCqZwaueq7WCmuLTcKSJmj737ol2hurA9eq9VdyiO8yWa3NNyog+SB5CZodSsQq/dfu34tJpYbBaTMzvVddDZu16q5smXf4G8zEvqm4cyaAmJPuTJk3oJWdS4WzcVtfMZbThSQckb/pYfRGgo3zNOqZnEHbJPGK4abaDCQIIsT8V/qTaBqHkLh6LzXH8XZQhbLhYKyyCC/WeHYcNdmvOgfe8skzbWL270/T3wf7tSx/lGCbTu8xlzzmCSWLc5iwmgikcCHi3Mga0Ry913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kpbZqTD0W+DxaA74CWzLN2nd14OlL72J38Lf7+TjC7dadZFDoZJQPrtaIKL/G0L6ktptPZVJ8fMqHYPZOKYPMyQGadIJfDvdXwAFiZOTvDBPydf5vk4rWA+RfdhBlaF/yDDBRoMu9pfnSjv/p7DG+HXfAcQcc49v/BBgAcFAO4DmB2GQAAAAASUVORK5CYII=";
const UPDATED_SRC = TEST_URL_ROOT + "doc_markup_tooltip.png";
const UPDATED_SRC = URL_ROOT + "doc_markup_tooltip.png";
const INITIAL_SRC_SIZE = "64" + " \u00D7 " + "64";
const UPDATED_SRC_SIZE = "22" + " \u00D7 " + "23";
add_task(function*() {
yield addTab("data:text/html,<p>markup view tooltip test</p><img>");
let { inspector } = yield openInspector();
let { inspector } = yield openInspectorForURL(
"data:text/html,<p>markup view tooltip test</p><img>");
info("Retrieving NodeFront for the <img> element.");
let img = yield getNodeFront("img", inspector);

View File

@ -11,7 +11,7 @@ requestLongerTimeout(2);
const TEST_URL = "data:text/html;charset=utf8,<div id='test' a b c d e></div>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Focusing the tag editor of the test element");
let {editor} = yield getContainerForSelector("div", inspector);

View File

@ -10,7 +10,7 @@
const TEST_URL = "data:text/html;charset=utf8,<div></div>";
add_task(function*() {
let {inspector, toolbox} = yield addTab(TEST_URL).then(openInspector);
let {inspector, toolbox} = yield openInspectorForURL(TEST_URL);
info("Focusing the tag editor of the test element");
let {editor} = yield getContainerForSelector("div", inspector);

View File

@ -11,7 +11,7 @@
const TEST_URL = "data:text/html;charset=utf8,<div class='test-class'></div>Text node";
add_task(function*() {
let {inspector, toolbox} = yield addTab(TEST_URL).then(openInspector);
let {inspector, toolbox} = yield openInspectorForURL(TEST_URL);
let {walker} = inspector;
info("Select the test node to have the 2 test containers visible");

View File

@ -14,7 +14,7 @@ requestLongerTimeout(2);
const TEST_URL = "data:text/html;charset=utf8,<div>test element</div>";
add_task(function*() {
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
info("Select the test node with the browser ctx menu");
yield selectWithBrowserMenu(inspector);
@ -26,7 +26,7 @@ add_task(function*() {
assertNodeSelected(inspector, "body");
info("Select the test node with the element picker");
yield selectWithElementPicker(inspector);
yield selectWithElementPicker(inspector, testActor);
assertNodeSelected(inspector, "div");
info("Press arrowUp to focus <body> " +
@ -71,16 +71,13 @@ function* selectWithBrowserMenu(inspector) {
yield inspector.once("inspector-updated");
}
function* selectWithElementPicker(inspector) {
function* selectWithElementPicker(inspector, testActor) {
yield inspector.toolbox.highlighterUtils.startPicker();
yield BrowserTestUtils.synthesizeMouseAtCenter("div", {
type: "mousemove",
}, gBrowser.selectedBrowser);
executeInContent("Test:SynthesizeKey", {
key: "VK_RETURN",
options: {}
}, {}, false);
yield testActor.synthesizeKey({key: "VK_RETURN", options: {}});
yield inspector.once("inspector-updated");
}

View File

@ -25,7 +25,7 @@ const TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let {walker} = inspector;
for (let {selector, attribute} of TEST_DATA) {

View File

@ -7,7 +7,7 @@
// Tests that links are shown in attributes when the values (or part of the
// values) are URIs or pointers to IDs.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
const TEST_DATA = [{
selector: "link",
@ -102,7 +102,7 @@ const TEST_DATA = [{
requestLongerTimeout(2);
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
for (let {selector, attributes} of TEST_DATA) {
info("Testing attributes on node " + selector);

View File

@ -7,10 +7,10 @@
// Tests that attributes are linkified correctly when attributes are updated
// and created.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Adding a contextmenu attribute to the body node");
yield addNewAttributes("body", "contextmenu=\"menu1\"", inspector);

View File

@ -6,14 +6,14 @@
// Tests that links appear correctly in attributes created in content.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
info("Adding a contextmenu attribute to the body node via the content");
let onMutated = inspector.once("markupmutation");
yield setNodeAttribute("body", "contextmenu", "menu1");
yield setNodeAttribute("body", "contextmenu", "menu1", testActor);
yield onMutated;
info("Checking for links in the new attribute");
@ -25,7 +25,7 @@ add_task(function*() {
info("Editing the contextmenu attribute on the body node");
onMutated = inspector.once("markupmutation");
yield setNodeAttribute("body", "contextmenu", "menu2");
yield setNodeAttribute("body", "contextmenu", "menu2", testActor);
yield onMutated;
info("Checking for links in the updated attribute");

View File

@ -7,7 +7,7 @@
// Tests that the contextual menu shows the right items when clicking on a link
// in an attribute.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
const STRINGS = Services.strings
.createBundle("chrome://devtools/locale/inspector.properties");
const TOOLBOX_STRINGS = Services.strings
@ -69,7 +69,7 @@ const TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let linkFollow = inspector.panelDoc.getElementById("node-menu-link-follow");
let linkCopy = inspector.panelDoc.getElementById("node-menu-link-copy");

View File

@ -7,10 +7,10 @@
// Tests that the contextual menu items shown when clicking on links in
// attributes actually do the right things.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Select a node with a URI attribute");
yield selectNode("video", inspector);
@ -27,7 +27,7 @@ add_task(function*() {
yield waitForTabLoad(tab);
ok(true, "A new tab opened");
is(tab.linkedBrowser.currentURI.spec, TEST_URL_ROOT + "doc_markup_tooltip.png",
is(tab.linkedBrowser.currentURI.spec, URL_ROOT + "doc_markup_tooltip.png",
"The URL for the new tab is correct");
gBrowser.removeTab(tab);

View File

@ -7,10 +7,10 @@
// Tests that the contextual menu items shown when clicking on linked attributes
// for <script> and <link> tags actually open the right tools.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
add_task(function*() {
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {toolbox, inspector} = yield openInspectorForURL(TEST_URL);
info("Select a node with a cssresource attribute");
yield selectNode("link", inspector);

View File

@ -7,10 +7,10 @@
// Tests that a middle-click or meta/ctrl-click on links in attributes actually
// do follows the link.
const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html";
const TEST_URL = URL_ROOT + "doc_markup_links.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Select a node with a URI attribute");
yield selectNode("video", inspector);
@ -21,11 +21,11 @@ add_task(function*() {
info("Follow the link with middle-click and wait for the new tab to open");
yield followLinkWaitForTab(linkEl, false,
TEST_URL_ROOT + "doc_markup_tooltip.png");
URL_ROOT + "doc_markup_tooltip.png");
info("Follow the link with meta/ctrl-click and wait for the new tab to open");
yield followLinkWaitForTab(linkEl, true,
TEST_URL_ROOT + "doc_markup_tooltip.png");
URL_ROOT + "doc_markup_tooltip.png");
info("Select a node with a IDREF attribute");
yield selectNode("label", inspector);

View File

@ -33,17 +33,16 @@ const TEST_URL = "data:text/html," +
"</html>";
add_task(function*() {
let tab = yield addTab(TEST_URL);
let {inspector} = yield openInspector();
let {inspector, testActor, tab} = yield openInspectorForURL(TEST_URL);
let domContentLoaded = waitForLinkedBrowserEvent(tab, "DOMContentLoaded");
let pageLoaded = waitForLinkedBrowserEvent(tab, "load");
ok (inspector.markup, "There is a markup view");
// Select an element while the tab is in the middle of a slow reload.
reloadTab();
reloadTab(testActor);
yield domContentLoaded;
yield chooseWithInspectElementContextMenu("img");
yield chooseWithInspectElementContextMenu("img", testActor);
yield pageLoaded;
yield inspector.once("markuploaded");
@ -51,13 +50,13 @@ add_task(function*() {
is (inspector.markup._elt.children.length, 1, "The markup view is rendering");
});
function* chooseWithInspectElementContextMenu(selector) {
function* chooseWithInspectElementContextMenu(selector, testActor) {
yield BrowserTestUtils.synthesizeMouseAtCenter(selector, {
type: "contextmenu",
button: 2
}, gBrowser.selectedBrowser);
executeInContent("Test:SynthesizeKey", {key: "Q", options: {}});
yield testActor.synthesizeKey({key: "Q", options: {}});
}
function waitForLinkedBrowserEvent(tab, event) {

View File

@ -6,7 +6,7 @@
// Tests that various mutations to the dom update the markup view correctly.
const TEST_URL = TEST_URL_ROOT + "doc_markup_mutation.html";
const TEST_URL = URL_ROOT + "doc_markup_mutation.html";
// Mutation tests. Each entry in the array has the following properties:
// - desc: for logging only
@ -263,7 +263,7 @@ const TEST_DATA = [
];
add_task(function*() {
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {toolbox, inspector} = yield openInspectorForURL(TEST_URL);
info("Expanding all markup-view nodes");
yield inspector.markup.expandAll();

View File

@ -7,7 +7,7 @@
// Test that markup-containers in the markup-view do flash when their
// corresponding DOM nodes mutate
const TEST_URL = TEST_URL_ROOT + "doc_markup_flashing.html";
const TEST_URL = URL_ROOT + "doc_markup_flashing.html";
// The test data contains a list of mutations to test.
// Each item is an object:
@ -74,7 +74,7 @@ const TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
// Make sure mutated nodes flash for a very long time so we can more easily
// assert they do

View File

@ -6,7 +6,7 @@
// Test that the markup-view nodes can be navigated to with the keyboard
const TEST_URL = TEST_URL_ROOT + "doc_markup_navigation.html";
const TEST_URL = URL_ROOT + "doc_markup_navigation.html";
const TEST_DATA = [
["pageup", "*doctype*"],
["down", "html"],
@ -67,7 +67,7 @@ const TEST_DATA = [
];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Making sure the markup-view frame is focused");
inspector.markup._frame.focus();

View File

@ -12,7 +12,7 @@
// having to visit each and every child of a hidden node. So there's no sense
// testing children nodes.
const TEST_URL = TEST_URL_ROOT + "doc_markup_not_displayed.html";
const TEST_URL = URL_ROOT + "doc_markup_not_displayed.html";
const TEST_DATA = [
{selector: "#normal-div", isDisplayed: true},
{selector: "head", isDisplayed: false},
@ -22,7 +22,7 @@ const TEST_DATA = [
];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
for (let {selector, isDisplayed} of TEST_DATA) {
info("Getting node " + selector);

View File

@ -7,7 +7,7 @@
// Tests that nodes are marked as displayed and not-displayed dynamically, when
// their display changes
const TEST_URL = TEST_URL_ROOT + "doc_markup_not_displayed.html";
const TEST_URL = URL_ROOT + "doc_markup_not_displayed.html";
const TEST_DATA = [
{
desc: "Hiding a node by creating a new stylesheet",
@ -90,7 +90,7 @@ const TEST_DATA = [
];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
for (let data of TEST_DATA) {
info("Running test case: " + data.desc);

View File

@ -9,7 +9,7 @@
Services.prefs.setIntPref("devtools.markup.pagesize", 5);
const TEST_URL = TEST_URL_ROOT + "doc_markup_pagesize_01.html";
const TEST_URL = URL_ROOT + "doc_markup_pagesize_01.html";
const TEST_DATA = [{
desc: "Select the last item",
selector: "#z",
@ -38,7 +38,7 @@ const TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Start iterating through the test data");
for (let step of TEST_DATA) {

View File

@ -8,13 +8,13 @@
// by the devtools.markup.pagesize preference and that pressing the "show all nodes"
// actually shows the nodes
const TEST_URL = TEST_URL_ROOT + "doc_markup_pagesize_02.html";
const TEST_URL = URL_ROOT + "doc_markup_pagesize_02.html";
// Make sure nodes are hidden when there are more than 5 in a row
Services.prefs.setIntPref("devtools.markup.pagesize", 5);
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Selecting the UL node");
yield clickContainer("ul", inspector);

View File

@ -7,10 +7,10 @@
// Test confirms that XUL attributes don't show up as empty
// attributes after being deleted
const TEST_URL = TEST_URL_ROOT + "doc_markup_xul.xul";
const TEST_URL = URL_ROOT + "doc_markup_xul.xul";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let panel = yield getNode("#test", inspector);
let panelFront = yield getNodeFront("#test", inspector);

View File

@ -8,10 +8,10 @@
// selects the right nodes in the markup-view, even when those nodes are deeply
// nested (and therefore not attached yet when the markup-view is initialized).
const TEST_URL = TEST_URL_ROOT + "doc_markup_search.html";
const TEST_URL = URL_ROOT + "doc_markup_search.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
let container = yield getContainerForSelector("em", inspector);
ok(!container, "The <em> tag isn't present yet in the markup-view");

View File

@ -8,7 +8,7 @@
loadHelperScript("helper_attributes_test_runner.js");
const TEST_URL = TEST_URL_ROOT + "doc_markup_edit.html";
const TEST_URL = URL_ROOT + "doc_markup_edit.html";
var TEST_DATA = [{
desc: "Change an attribute",
node: "#node1",
@ -63,6 +63,6 @@ var TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
yield runEditAttributesTests(TEST_DATA, inspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield runEditAttributesTests(TEST_DATA, inspector, testActor);
});

View File

@ -10,7 +10,7 @@ const TEST_URL = "data:text/html,<div id='test-div'>Test modifying my ID attribu
add_task(function*() {
info("Opening the inspector on the test page");
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
info("Selecting the test node");
yield selectNode("#test-div", inspector);
@ -18,7 +18,7 @@ add_task(function*() {
info("Verify attributes, only ID should be there for now");
yield assertAttributes("#test-div", {
id: "test-div"
});
}, testActor);
info("Focus the ID attribute and change its content");
let {editor} = yield getContainerForSelector("#test-div", inspector);
@ -33,13 +33,11 @@ add_task(function*() {
id: "test-div",
class: "newclass",
style: "color:green"
});
}, testActor);
info("Trying to undo the change");
yield undoChange(inspector);
yield assertAttributes("#test-div", {
id: "test-div"
});
yield inspector.once("inspector-updated");
}, testActor);
});

View File

@ -9,7 +9,7 @@
const TEST_URL = "data:text/html;charset=utf-8,<div id='retag-me'><div id='retag-me-2'></div></div>";
add_task(function*() {
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield inspector.markup.expandAll();
@ -20,11 +20,11 @@ add_task(function*() {
let container = yield getContainerForSelector("#retag-me", inspector);
ok(container.expanded, "The container is expanded");
let parentInfo = yield getNodeInfo("#retag-me");
let parentInfo = yield getNodeInfo("#retag-me", testActor);
is(parentInfo.tagName.toLowerCase(), "div",
"We've got #retag-me element, it's a DIV");
is(parentInfo.numChildren, 1, "#retag-me has one child");
let childInfo = yield getNodeInfo("#retag-me > *");
let childInfo = yield getNodeInfo("#retag-me > *", testActor);
is(childInfo.attributes[0].value, "retag-me-2",
"#retag-me's only child is #retag-me-2");
@ -40,11 +40,11 @@ add_task(function*() {
ok(container.selected, "The container is still selected");
info("Checking that the tagname change was done");
parentInfo = yield getNodeInfo("#retag-me");
parentInfo = yield getNodeInfo("#retag-me", testActor);
is(parentInfo.tagName.toLowerCase(), "p",
"The #retag-me element is now a P");
is(parentInfo.numChildren, 1, "#retag-me still has one child");
childInfo = yield getNodeInfo("#retag-me > *");
childInfo = yield getNodeInfo("#retag-me > *", testActor);
is(childInfo.attributes[0].value, "retag-me-2",
"#retag-me's only child is #retag-me-2");
});

View File

@ -66,7 +66,7 @@ const TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
for (let {setup, selector, key, focusedSelector} of TEST_DATA) {
if (setup) {

View File

@ -72,6 +72,6 @@ var TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
yield runAddAttributesTests(TEST_DATA, "div", inspector)
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield runAddAttributesTests(TEST_DATA, "div", inspector, testActor)
});

View File

@ -79,6 +79,6 @@ var TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
yield runAddAttributesTests(TEST_DATA, "div", inspector)
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield runAddAttributesTests(TEST_DATA, "div", inspector, testActor)
});

View File

@ -96,7 +96,7 @@ var TEST_DATA = [{
}];
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
yield runAddAttributesTests(TEST_DATA, "div", inspector)
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield runAddAttributesTests(TEST_DATA, "div", inspector, testActor);
});

View File

@ -7,33 +7,33 @@
// Test editing various markup-containers' attribute fields, in particular
// attributes with long values and quotes
const TEST_URL = TEST_URL_ROOT + "doc_markup_edit.html";
const TEST_URL = URL_ROOT + "doc_markup_edit.html";
const LONG_ATTRIBUTE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const LONG_ATTRIBUTE_COLLAPSED = "ABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEF\u2026UVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZ-ABCDEFGHIJKLMNOPQRSTUVWXYZ";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield inspector.markup.expandAll();
yield testCollapsedLongAttribute(inspector);
yield testModifyInlineStyleWithQuotes(inspector);
yield testEditingAttributeWithMixedQuotes(inspector);
yield testCollapsedLongAttribute(inspector, testActor);
yield testModifyInlineStyleWithQuotes(inspector, testActor);
yield testEditingAttributeWithMixedQuotes(inspector, testActor);
});
function* testCollapsedLongAttribute(inspector) {
function* testCollapsedLongAttribute(inspector, testActor) {
info("Try to modify the collapsed long attribute, making sure it expands.");
info("Adding test attributes to the node");
let onMutated = inspector.once("markupmutation");
yield setNodeAttribute("#node24", "class", "");
yield setNodeAttribute("#node24", "data-long", LONG_ATTRIBUTE);
yield setNodeAttribute("#node24", "class", "", testActor);
yield setNodeAttribute("#node24", "data-long", LONG_ATTRIBUTE, testActor);
yield onMutated;
yield assertAttributes("#node24", {
id: "node24",
"class": "",
"data-long": LONG_ATTRIBUTE
});
}, testActor);
let {editor} = yield getContainerForSelector("#node24", inspector);
let attr = editor.attrElements.get("data-long").querySelector(".editable");
@ -56,16 +56,16 @@ function* testCollapsedLongAttribute(inspector) {
class: "",
'data-long': LONG_ATTRIBUTE,
"data-short": "ABC"
});
}, testActor);
}
function* testModifyInlineStyleWithQuotes(inspector) {
function* testModifyInlineStyleWithQuotes(inspector, testActor) {
info("Modify inline style containing \"");
yield assertAttributes("#node26", {
id: "node26",
style: 'background-image: url("moz-page-thumb://thumbnail?url=http%3A%2F%2Fwww.mozilla.org%2F");'
});
}, testActor);
let onMutated = inspector.once("markupmutation");
let {editor} = yield getContainerForSelector("#node26", inspector);
@ -92,16 +92,16 @@ function* testModifyInlineStyleWithQuotes(inspector) {
yield assertAttributes("#node26", {
id: "node26",
style: 'background-image: url("moz-page-thumb://thumbnail?url=http%3A%2F%2Fwww.mozilla.com%2F");'
});
}, testActor);
}
function* testEditingAttributeWithMixedQuotes(inspector) {
function* testEditingAttributeWithMixedQuotes(inspector, testActor) {
info("Modify class containing \" and \'");
yield assertAttributes("#node27", {
"id": "node27",
"class": 'Double " and single \''
});
}, testActor);
let onMutated = inspector.once("markupmutation");
let {editor} = yield getContainerForSelector("#node27", inspector);
@ -125,5 +125,5 @@ function* testEditingAttributeWithMixedQuotes(inspector) {
yield assertAttributes("#node27", {
id: "node27",
class: '" " and \' \''
});
}, testActor);
}

View File

@ -6,19 +6,19 @@
// Test that editing a mixed-case attribute preserves the case
const TEST_URL = TEST_URL_ROOT + "doc_markup_svg_attributes.html";
const TEST_URL = URL_ROOT + "doc_markup_svg_attributes.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield inspector.markup.expandAll();
yield selectNode("svg", inspector);
yield testWellformedMixedCase(inspector);
yield testMalformedMixedCase(inspector);
yield testWellformedMixedCase(inspector, testActor);
yield testMalformedMixedCase(inspector, testActor);
});
function* testWellformedMixedCase(inspector) {
function* testWellformedMixedCase(inspector, testActor) {
info("Modifying a mixed-case attribute, " +
"expecting the attribute's case to be preserved");
@ -41,10 +41,10 @@ function* testWellformedMixedCase(inspector) {
"viewBox": "0 0 1 1",
"width": "200",
"height": "200"
});
}, testActor);
}
function* testMalformedMixedCase(inspector) {
function* testMalformedMixedCase(inspector, testActor) {
info("Modifying a malformed, mixed-case attribute, " +
"expecting the attribute's case to be preserved");
@ -67,5 +67,5 @@ function* testMalformedMixedCase(inspector) {
"viewBox": "<>",
"width": "200",
"height": "200"
});
}, testActor);
}

View File

@ -9,7 +9,7 @@
const TEST_URL = "data:text/html;charset=utf-8,<div></div>";
add_task(function*() {
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {toolbox, inspector} = yield openInspectorForURL(TEST_URL);
yield inspector.markup.expandAll();
yield selectNode("div", inspector);

View File

@ -12,7 +12,7 @@ const TEST_URL = "data:text/html;charset=utf-8,<div></div>";
add_task(function*() {
let isEditTagNameCalled = false;
let {toolbox, inspector} = yield addTab(TEST_URL).then(openInspector);
let {toolbox, inspector} = yield openInspectorForURL(TEST_URL);
// Overriding the editTagName walkerActor method here to check that it isn't
// called when blurring the tagname field.

View File

@ -10,7 +10,7 @@
const TEST_URL = "data:text/html;charset=utf8,<div id='attr' a='1' b='2' c='3'></div><div id='delattr' tobeinvalid='1' last='2'></div>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
yield testAttributeEditing(inspector);
yield testAttributeDeletion(inspector);

View File

@ -9,7 +9,7 @@
const TEST_URL = "data:text/html;charset=utf8,<div a b id='order' c class></div>";
add_task(function*() {
let {inspector, testActor} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield testOriginalAttributesOrder(inspector);
yield testOrderAfterAttributeChange(inspector, testActor);

View File

@ -6,10 +6,10 @@
// Test editing a node's text content
const TEST_URL = TEST_URL_ROOT + "doc_markup_edit.html";
const TEST_URL = URL_ROOT + "doc_markup_edit.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Expanding all nodes");
yield inspector.markup.expandAll();

View File

@ -6,10 +6,10 @@
// Test toggling (expand/collapse) elements by clicking on twisties
const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html";
const TEST_URL = URL_ROOT + "doc_markup_toggle.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Getting the container for the html element");
let container = yield getContainerForSelector("html", inspector);

View File

@ -6,10 +6,10 @@
// Test toggling (expand/collapse) elements by dbl-clicking on tag lines
const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html";
const TEST_URL = URL_ROOT + "doc_markup_toggle.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Getting the container for the UL parent element");
let container = yield getContainerForSelector("ul", inspector);

View File

@ -7,10 +7,10 @@
// Test toggling (expand/collapse) elements by alt-clicking on twisties, which
// should expand all the descendants
const TEST_URL = TEST_URL_ROOT + "doc_markup_toggle.html";
const TEST_URL = URL_ROOT + "doc_markup_toggle.html";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {inspector} = yield openInspectorForURL(TEST_URL);
info("Getting the container for the UL parent element");
let container = yield getContainerForSelector("ul", inspector);

View File

@ -10,7 +10,7 @@ const URL_1 = SCHEMA + "<div id='one' style='color:red;'>ONE</div>";
const URL_2 = SCHEMA + "<div id='two' style='color:green;'>TWO</div>";
add_task(function* () {
let { inspector, toolbox } = yield addTab(URL_1).then(openInspector);
let { inspector, toolbox } = yield openInspectorForURL(URL_1);
assertMarkupViewIsLoaded();
yield selectNode("#one", inspector);

View File

@ -1,31 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Import the inspector's head.js first (which itself imports shared-head.js).
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/inspector/test/head.js",
this);
var Cu = Components.utils;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {TargetFactory} = require("devtools/client/framework/target");
var {console} = Cu.import("resource://gre/modules/Console.jsm", {});
var promise = require("promise");
var {getInplaceEditorForSpan: inplaceEditor} = require("devtools/client/shared/inplace-editor");
var clipboard = require("sdk/clipboard");
var {setTimeout, clearTimeout} = require("sdk/timers");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
// All test are asynchronous
waitForExplicitFinish();
// If a test times out we want to see the complete log and not just the last few
// lines.
SimpleTest.requestCompleteLog();
// Uncomment this pref to dump all devtools emitted events to the console.
// Services.prefs.setBoolPref("devtools.dump.emit", true);
// Import helpers registering the test-actor in remote targets
var testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "../../../../shared/test/test-actor-registry.js", this);
// Set the testing flag on DevToolsUtils and reset it when the test ends
DevToolsUtils.testing = true;
registerCleanupFunction(() => DevToolsUtils.testing = false);
@ -34,59 +24,11 @@ registerCleanupFunction(() => DevToolsUtils.testing = false);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.inspector.htmlPanelOpen");
Services.prefs.clearUserPref("devtools.inspector.sidebarOpen");
Services.prefs.clearUserPref("devtools.inspector.activeSidebar");
Services.prefs.clearUserPref("devtools.dump.emit");
Services.prefs.clearUserPref("devtools.markup.pagesize");
Services.prefs.clearUserPref("dom.webcomponents.enabled");
Services.prefs.clearUserPref("devtools.inspector.showAllAnonymousContent");
});
// Auto close the toolbox and close the test tabs when the test ends
registerCleanupFunction(function*() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
yield gDevTools.closeToolbox(target);
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});
const TEST_URL_ROOT =
"http://example.com/browser/devtools/client/inspector/markup/test/";
const CHROME_BASE =
"chrome://mochitests/content/browser/devtools/client/inspector/markup/test/";
const COMMON_FRAME_SCRIPT_URL =
"chrome://devtools/content/shared/frame-script-utils.js";
/**
* Add a new test tab in the browser and load the given url.
* @param {String} url The url to be loaded in the new tab
* @return a promise that resolves to the tab object when the url is loaded
*/
function addTab(url) {
info("Adding a new tab with URL: '" + url + "'");
let def = promise.defer();
// Bug 921935 should bring waitForFocus() support to e10s, which would
// probably cover the case of the test losing focus when the page is loading.
// For now, we just make sure the window is focused.
window.focus();
let tab = window.gBrowser.selectedTab = window.gBrowser.addTab(url);
let linkedBrowser = tab.linkedBrowser;
info("Loading the helper frame script " + COMMON_FRAME_SCRIPT_URL);
linkedBrowser.messageManager.loadFrameScript(COMMON_FRAME_SCRIPT_URL, false);
linkedBrowser.addEventListener("load", function onload() {
linkedBrowser.removeEventListener("load", onload, true);
info("URL '" + url + "' loading complete");
def.resolve(tab);
}, true);
return def.promise;
}
/**
* Some tests may need to import one or more of the test helper scripts.
* A test helper script is simply a js file that contains common test code that
@ -115,92 +57,13 @@ function reloadPage(inspector) {
return newRoot;
}
/**
* Open the toolbox, with given tool visible.
* @param {string} toolId ID of the tool that should be visible by default.
* @return a promise that resolves when the tool is ready.
*/
function openToolbox(toolId) {
info("Opening the inspector panel");
let deferred = promise.defer();
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, toolId).then(function(toolbox) {
info("The toolbox is open");
deferred.resolve({toolbox: toolbox});
}).then(null, console.error);
return deferred.promise;
}
/**
* Open the toolbox, with the inspector tool visible.
* @return a promise that resolves when the inspector is ready
*/
function openInspector() {
return openToolbox("inspector").then(({toolbox}) => {
let inspector = toolbox.getCurrentPanel();
let eventId = "inspector-updated";
return inspector.once("inspector-updated").then(() => {
info("The inspector panel is active and ready");
return registerTestActor(toolbox.target.client);
}).then(() => {
return getTestActor(toolbox);
}).then((testActor) => {
return {toolbox, inspector, testActor};
});
});
}
/**
* Wait for a content -> chrome message on the message manager (the window
* messagemanager is used).
* @param {String} name The message name
* @return {Promise} A promise that resolves to the response data when the
* message has been received
*/
function waitForContentMessage(name) {
info("Expecting message " + name + " from content");
let mm = gBrowser.selectedBrowser.messageManager;
let def = promise.defer();
mm.addMessageListener(name, function onMessage(msg) {
mm.removeMessageListener(name, onMessage);
def.resolve(msg.data);
});
return def.promise;
}
/**
* Send an async message to the frame script (chrome -> content) and wait for a
* response message with the same name (content -> chrome).
* @param {String} name The message name. Should be one of the messages defined
* in doc_frame_script.js
* @param {Object} data Optional data to send along
* @param {Object} objects Optional CPOW objects to send along
* @param {Boolean} expectResponse If set to false, don't wait for a response
* with the same name from the content script. Defaults to true.
* @return {Promise} Resolves to the response data if a response is expected,
* immediately resolves otherwise
*/
function executeInContent(name, data={}, objects={}, expectResponse=true) {
info("Sending message " + name + " to content");
let mm = gBrowser.selectedBrowser.messageManager;
mm.sendAsyncMessage(name, data, objects);
if (expectResponse) {
return waitForContentMessage(name);
} else {
return promise.resolve();
}
}
/**
* Reload the current tab location.
* @param {TestActorFront} testActor An instance of the current TestActorFront
* instantiated when the test started.
*/
function reloadTab() {
return executeInContent("devtools:test:reload", {}, {}, false);
function reloadTab(testActor) {
return testActor.eval("location.reload()");
}
/**
@ -217,27 +80,13 @@ function getNode(nodeOrSelector) {
nodeOrSelector;
}
/**
* Get the NodeFront for a given css selector, via the protocol
* @param {String|NodeFront} selector
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* loaded in the toolbox
* @return {Promise} Resolves to the NodeFront instance
*/
function getNodeFront(selector, {walker}) {
if (selector._form) {
return selector;
}
return walker.querySelector(walker.rootNode, selector);
}
/**
* Get information about a DOM element, identified by its selector.
* @param {String} selector.
* @return {Promise} a promise that resolves to the element's information.
*/
function getNodeInfo(selector) {
return executeInContent("devtools:test:getDomElementInfo", {selector});
function getNodeInfo(selector, testActor) {
return testActor.getNodeInfo(selector);
}
/**
@ -245,11 +94,11 @@ function getNodeInfo(selector) {
* @param {String} selector.
* @param {String} attributeName.
* @param {String} attributeValue.
* @param {Promise} resolves when done.
* @param {TestActorFront} testActor The current TestActorFront instance.
* @return {Promise} resolves when done.
*/
function setNodeAttribute(selector, attributeName, attributeValue) {
return executeInContent("devtools:test:setAttribute",
{selector, attributeName, attributeValue});
function setNodeAttribute(selector, attributeName, attributeValue, testActor) {
return testActor.setAttribute(selector, attributeName, attributeValue);
}
/**
@ -270,24 +119,6 @@ function selectAndHighlightNode(nodeOrSelector, inspector) {
return updated;
}
/**
* Set the inspector's current selection to the first match of the given css
* selector
* @param {String|NodeFront} selector
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* loaded in the toolbox
* @param {String} reason Defaults to "test" which instructs the inspector not
* to highlight the node upon selection
* @return {Promise} Resolves when the inspector is updated with the new node
*/
var selectNode = Task.async(function*(selector, inspector, reason="test") {
info("Selecting the node for '" + selector + "'");
let nodeFront = yield getNodeFront(selector, inspector);
let updated = inspector.once("inspector-updated");
inspector.selection.setNodeFront(nodeFront, reason);
yield updated;
});
/**
* Get the MarkupContainer object instance that corresponds to the given
* NodeFront
@ -410,12 +241,13 @@ var addNewAttributes = Task.async(function*(selector, text, inspector) {
* @param {String} selector The selector for the node to check.
* @param {Object} expected An object containing the attributes to check.
* e.g. {id: "id1", class: "someclass"}
* @param {TestActorFront} testActor The current TestActorFront instance.
*
* Note that node.getAttribute() returns attribute values provided by the HTML
* parser. The parser only provides unescaped entities so &amp; will return &.
*/
var assertAttributes = Task.async(function*(selector, expected) {
let {attributes: actual} = yield getNodeInfo(selector);
var assertAttributes = Task.async(function*(selector, expected, testActor) {
let {attributes: actual} = yield getNodeInfo(selector, testActor);
is(actual.length, Object.keys(expected).length,
"The node " + selector + " has the expected number of attributes.");
@ -503,37 +335,6 @@ function wait(ms) {
return def.promise;
}
/**
* Wait for eventName on target.
* @param {Object} target An observable object that either supports on/off or
* addEventListener/removeEventListener
* @param {String} eventName
* @param {Boolean} useCapture Optional, for addEventListener/removeEventListener
* @return A promise that resolves when the event has been handled
*/
function once(target, eventName, useCapture=false) {
info("Waiting for event: '" + eventName + "' on " + target + ".");
let deferred = promise.defer();
for (let [add, remove] of [
["addEventListener", "removeEventListener"],
["addListener", "removeListener"],
["on", "off"]
]) {
if ((add in target) && (remove in target)) {
target[add](eventName, function onEvent(...aArgs) {
info("Got event: '" + eventName + "' on " + target + ".");
target[remove](eventName, onEvent, useCapture);
deferred.resolve.apply(deferred, aArgs);
}, useCapture);
break;
}
}
return deferred.promise;
}
/**
* Check to see if the inspector menu items for editing are disabled.
* Things like Edit As HTML, Delete Node, etc.

View File

@ -15,16 +15,17 @@
* when the test starts. It will be used to add and remove attributes.
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* opened
* @param {TestActorFront} testActor The current TestActorFront instance.
* @return a promise that resolves when the tests have run
*/
function runAddAttributesTests(tests, nodeOrSelector, inspector) {
function runAddAttributesTests(tests, nodeOrSelector, inspector, testActor) {
info("Running " + tests.length + " add-attributes tests");
return Task.spawn(function*() {
info("Selecting the test node");
yield selectNode("div", inspector);
for (let test of tests) {
yield runAddAttributesTest(test, "div", inspector);
yield runAddAttributesTest(test, "div", inspector, testActor);
}
});
}
@ -47,9 +48,10 @@ function runAddAttributesTests(tests, nodeOrSelector, inspector) {
* - {InspectorPanel} The instance of the InspectorPanel opened
* @param {String} selector The node selector corresponding to the test element
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* @param {TestActorFront} testActor The current TestActorFront instance.
* opened
*/
function* runAddAttributesTest(test, selector, inspector) {
function* runAddAttributesTest(test, selector, inspector, testActor) {
if (test.setUp) {
test.setUp(inspector);
}
@ -59,7 +61,7 @@ function* runAddAttributesTest(test, selector, inspector) {
yield addNewAttributes(selector, test.text, inspector);
info("Assert that the attribute(s) has/have been applied correctly");
yield assertAttributes(selector, test.expectedAttributes);
yield assertAttributes(selector, test.expectedAttributes, testActor);
if (test.validate) {
let container = yield getContainerForSelector(selector, inspector);
@ -70,7 +72,7 @@ function* runAddAttributesTest(test, selector, inspector) {
yield undoChange(inspector);
info("Assert that the attribute(s) has/have been removed correctly");
yield assertAttributes(selector, {});
yield assertAttributes(selector, {}, testActor);
if (test.tearDown) {
test.tearDown(inspector);
}
@ -87,19 +89,18 @@ function* runAddAttributesTest(test, selector, inspector) {
* @param {Array} tests See runEditAttributesTest for the structure
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* opened
* @param {TestActorFront} testActor The current TestActorFront instance.
* @return a promise that resolves when the tests have run
*/
function runEditAttributesTests(tests, inspector) {
function runEditAttributesTests(tests, inspector, testActor) {
info("Running " + tests.length + " edit-attributes tests");
return Task.spawn(function*() {
info("Expanding all nodes in the markup-view");
yield inspector.markup.expandAll();
for (let test of tests) {
yield runEditAttributesTest(test, inspector);
yield runEditAttributesTest(test, inspector, testActor);
}
yield inspector.once("inspector-updated");
});
}
@ -118,16 +119,17 @@ function runEditAttributesTests(tests, inspector) {
* - expectedAttributes {Object} a key/value pair object that will be
* used to check the attributes on the test element
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* @param {TestActorFront} testActor The current TestActorFront instance.
* opened
*/
function* runEditAttributesTest(test, inspector) {
function* runEditAttributesTest(test, inspector, testActor) {
info("Starting edit-attribute test: " + test.desc);
info("Selecting the test node " + test.node);
yield selectNode(test.node, inspector);
info("Asserting that the node has the right attributes to start with");
yield assertAttributes(test.node, test.originalAttributes);
yield assertAttributes(test.node, test.originalAttributes, testActor);
info("Editing attribute " + test.name + " with value " + test.value);
@ -142,13 +144,13 @@ function* runEditAttributesTest(test, inspector) {
yield nodeMutated;
info("Asserting the new attributes after edition");
yield assertAttributes(test.node, test.expectedAttributes);
yield assertAttributes(test.node, test.expectedAttributes, testActor);
info("Undo the change and assert that the attributes have been changed back");
yield undoChange(inspector);
yield assertAttributes(test.node, test.originalAttributes);
yield assertAttributes(test.node, test.originalAttributes, testActor);
info("Redo the change and assert that the attributes have been changed again");
yield redoChange(inspector);
yield assertAttributes(test.node, test.expectedAttributes);
yield assertAttributes(test.node, test.expectedAttributes, testActor);
}

View File

@ -7,7 +7,7 @@
* TEST_DATA array.
*/
function* runEventPopupTests() {
let {inspector, testActor} = yield addTab(TEST_URL).then(openInspector);
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
yield inspector.markup.expandAll();

View File

@ -13,13 +13,14 @@
* @param {Array} tests See runEditOuterHTMLTest for the structure
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* opened
* @param {TestActorFront} testActor The current TestActorFront instance
* @return a promise that resolves when the tests have run
*/
function runEditOuterHTMLTests(tests, inspector) {
function runEditOuterHTMLTests(tests, inspector, testActor) {
info("Running " + tests.length + " edit-outer-html tests");
return Task.spawn(function* () {
for (let step of TEST_DATA) {
yield runEditOuterHTMLTest(step, inspector);
yield runEditOuterHTMLTest(step, inspector, testActor);
}
});
}
@ -35,9 +36,10 @@ function runEditOuterHTMLTests(tests, inspector) {
* after the new outer-html has been inserted. Should be used to verify
* the actual DOM, see if it corresponds to the newHTML string provided
* @param {InspectorPanel} inspector The instance of InspectorPanel currently
* @param {TestActorFront} testActor The current TestActorFront instance
* opened
*/
function* runEditOuterHTMLTest(test, inspector) {
function* runEditOuterHTMLTest(test, inspector, testActor) {
info("Running an edit outerHTML test on '" + test.selector + "'");
yield selectNode(test.selector, inspector);
let oldNodeFront = inspector.selection.nodeFront;
@ -60,7 +62,7 @@ function* runEditOuterHTMLTest(test, inspector) {
yield test.validate(pageNode, pageNodeFront, selectedNodeFront, inspector);
} else {
is(pageNodeFront, selectedNodeFront, "Original node (grabbed by selector) is selected");
let {outerHTML} = yield getNodeInfo(test.selector);
let {outerHTML} = yield getNodeInfo(test.selector, testActor);
is(outerHTML, test.newHTML, "Outer HTML has been updated");
}

View File

@ -148,42 +148,6 @@ addMessageListener("devtools:test:setStyle", function(msg) {
sendAsyncMessage("devtools:test:setStyle");
});
/**
* Get information about a DOM element, identified by a selector.
* @param {Object} data
* - {String} selector The CSS selector to get the node (can be a "super"
* selector).
* @return {Object} data Null if selector didn't match any node, otherwise:
* - {String} tagName.
* - {String} namespaceURI.
* - {Number} numChildren The number of children in the element.
* - {Array} attributes An array of {name, value, namespaceURI} objects.
* - {String} outerHTML.
* - {String} innerHTML.
* - {String} textContent.
*/
addMessageListener("devtools:test:getDomElementInfo", function(msg) {
let {selector} = msg.data;
let node = superQuerySelector(selector);
let info = null;
if (node) {
info = {
tagName: node.tagName,
namespaceURI: node.namespaceURI,
numChildren: node.children.length,
attributes: [...node.attributes].map(({name, value, namespaceURI}) => {
return {name, value, namespaceURI};
}),
outerHTML: node.outerHTML,
innerHTML: node.innerHTML,
textContent: node.textContent
};
}
sendAsyncMessage("devtools:test:getDomElementInfo", info);
});
/**
* Set a given attribute value on a node.
* @param {Object} data

View File

@ -556,6 +556,47 @@ var TestActor = exports.TestActor = protocol.ActorClass({
value: RetVal("json")
}
}),
/**
* Get information about a DOM element, identified by a selector.
* @param {String} selector The CSS selector to get the node (can be an array
* of selectors to get elements in an iframe).
* @return {Object} data Null if selector didn't match any node, otherwise:
* - {String} tagName.
* - {String} namespaceURI.
* - {Number} numChildren The number of children in the element.
* - {Array} attributes An array of {name, value, namespaceURI} objects.
* - {String} outerHTML.
* - {String} innerHTML.
* - {String} textContent.
*/
getNodeInfo: protocol.method(function(selector) {
let node = this._querySelector(selector);
let info = null;
if (node) {
info = {
tagName: node.tagName,
namespaceURI: node.namespaceURI,
numChildren: node.children.length,
attributes: [...node.attributes].map(({name, value, namespaceURI}) => {
return {name, value, namespaceURI};
}),
outerHTML: node.outerHTML,
innerHTML: node.innerHTML,
textContent: node.textContent
};
}
return info;
}, {
request: {
selector: Arg(0, "string")
},
response: {
value: RetVal("json")
}
})
});
var TestActorFront = exports.TestActorFront = protocol.FrontClass(TestActor, {