Bug 1314057 - Update canvasdebugger to use the new debugger. r=jlast

--HG--
extra : rebase_source : baefdc15de6cda641d5a94300ff9a5ba2006ec2c
This commit is contained in:
David Walsh 2018-09-14 21:31:23 -05:00
Родитель 8da4c56f48
Коммит eb3628590d
9 изменённых файлов: 40 добавлений и 39 удалений

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

@ -12,6 +12,7 @@ support-files =
service-workers/simple.html
service-workers/simple-unicode.html
!/devtools/client/debugger/new/test/mochitest/helpers.js
!/devtools/client/debugger/new/test/mochitest/helpers/context.js
!/devtools/client/shared/test/frame-script-utils.js
!/devtools/client/shared/test/shared-head.js
!/devtools/client/shared/test/telemetry-test-helpers.js

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

@ -8,6 +8,11 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers.js",
this);
/* import-globals-from ../../debugger/new/test/mochitest/helpers/context.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
const TAB_URL = URL_ROOT + "service-workers/debug.html";
add_task(async function() {

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

@ -17,6 +17,7 @@ support-files =
head.js
!/devtools/client/shared/test/frame-script-utils.js
!/devtools/client/shared/test/shared-head.js
!/devtools/client/debugger/new/test/mochitest/helpers/context.js
!/devtools/client/shared/test/telemetry-test-helpers.js
[browser_canvas-actor-test-01.js]

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

@ -5,11 +5,7 @@
* Tests if the a function call's stack is properly displayed in the UI.
*/
// Force the old debugger UI since it's directly used (see Bug 1301705)
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
});
requestLongerTimeout(2);
async function ifTestingSupported() {
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
@ -70,12 +66,8 @@ async function ifTestingSupported() {
await jumpedToSource;
const toolbox = await gDevTools.getToolbox(target);
const { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
"The expected source was shown in the debugger.");
is(view.editor.getCursor().line, 25,
"The expected source line is highlighted in the debugger.");
const dbg = createDebuggerContext(toolbox);
await validateDebuggerLocation(dbg, SIMPLE_CANVAS_DEEP_STACK_URL, 26);
await teardown(panel);
finish();

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

@ -6,11 +6,7 @@
* and jumping to source in the debugger for the topmost call item works.
*/
// Force the old debugger UI since it's directly used (see Bug 1301705)
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
});
requestLongerTimeout(2);
async function ifTestingSupported() {
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
@ -45,12 +41,8 @@ async function ifTestingSupported() {
await jumpedToSource;
const toolbox = await gDevTools.getToolbox(target);
const { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
"The expected source was shown in the debugger.");
is(view.editor.getCursor().line, 23,
"The expected source line is highlighted in the debugger.");
const dbg = createDebuggerContext(toolbox);
await validateDebuggerLocation(dbg, SIMPLE_CANVAS_DEEP_STACK_URL, 24);
await teardown(panel);
finish();

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

@ -3,6 +3,7 @@
/* eslint no-unused-vars: [2, {"vars": "local"}] */
/* import-globals-from ../../shared/test/shared-head.js */
/* import-globals-from ../../debugger/new/test/mochitest/helpers/context.js */
"use strict";
@ -11,6 +12,11 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
this);
// Import helpers for the new debugger
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
var { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
@ -173,3 +179,13 @@ function getSourceActor(aSources, aURL) {
const item = aSources.getItemForAttachment(a => a.source.url === aURL);
return item ? item.value : null;
}
async function validateDebuggerLocation(dbg, url, line) {
const location = dbg.selectors.getSelectedLocation(dbg.getState());
const sourceUrl = dbg.selectors.getSelectedSource(dbg.getState()).url;
is(sourceUrl, url,
"The expected source was shown in the debugger.");
is(location.line, line,
"The expected source line is highlighted in the debugger.");
}

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

@ -6,6 +6,11 @@
* required from other panel test files.
*/
// Import helpers for the new debugger
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
var { Toolbox } = require("devtools/client/framework/toolbox");
var { Task } = require("devtools/shared/task");
var asyncStorage = require("devtools/shared/async-storage");
@ -462,23 +467,6 @@ function isSelectedFrameSelected(dbg, state) {
return source.id == sourceId;
}
function createDebuggerContext(toolbox) {
const panel = toolbox.getPanel("jsdebugger");
const win = panel.panelWin;
const { store, client, selectors, actions } = panel.getVarsForTests();
return {
actions: actions,
selectors: selectors,
getState: store.getState,
store: store,
client: client,
toolbox: toolbox,
win: win,
panel: panel
};
}
/**
* Clear all the debugger related preferences.
*/

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

@ -70,6 +70,7 @@ support-files =
lib_react_with_addons_15.4.1.js
react_external_listeners.js
!/devtools/client/debugger/new/test/mochitest/helpers.js
!/devtools/client/debugger/new/test/mochitest/helpers/context.js
!/devtools/client/inspector/test/head.js
!/devtools/client/inspector/test/shared-head.js
!/devtools/client/shared/test/shared-head.js

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

@ -15,6 +15,11 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers.js",
this);
/* import-globals-from ../../../debugger/new/test/mochitest/helpers/context.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
<test-component></test-component>
<other-component>some-content</other-component>