Bug 1003095 - Refactor breakpoint tests to run against multiple loaders;r=past

This commit is contained in:
Eddy Bruel 2014-05-15 16:47:12 +02:00
Родитель b5009853fd
Коммит a50cf14136
19 изменённых файлов: 257 добавлений и 93 удалений

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

@ -7,12 +7,14 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const { DevToolsLoader, devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const worker = new DevToolsLoader(); // TODO: Replace this with the worker loader
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const Services = devtools.require("Services");
const DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
const { DebuggerServer } = devtools.require("devtools/server/main");
const { DebuggerServer: WorkerDebuggerServer } = worker.require("devtools/server/main");
// Always log packets when running tests. runxpcshelltests.py will throw
// the output away anyway, unless you give it the --verbose flag.

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

@ -4,23 +4,31 @@
/**
* Check basic breakpoint functionality.
*/
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_simple_breakpoint();
});
});
do_test_pending();
}
function test_simple_breakpoint()
@ -46,7 +54,7 @@ function test_simple_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -8,19 +8,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_breakpoint_running();
});
});
do_test_pending();
}
function test_breakpoint_running()
@ -44,7 +53,7 @@ function test_breakpoint_running()
do_check_neq(aResponse.error, "noScript");
do_execute_soon(function() {
finishClient(gClient);
gClient.close(gCallback);
});
});
}

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

@ -8,12 +8,22 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient,
"test-stack",
@ -22,7 +32,6 @@ function run_test()
test_skip_breakpoint();
});
});
do_test_pending();
}
function test_skip_breakpoint()
@ -49,7 +58,7 @@ function test_skip_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -8,19 +8,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_child_breakpoint();
});
});
do_test_pending();
}
function test_child_breakpoint()
@ -45,7 +54,7 @@ function test_child_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_child_skip_breakpoint();
});
});
do_test_pending();
}
function test_child_skip_breakpoint()
@ -47,7 +56,7 @@ function test_child_skip_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_nested_breakpoint();
});
});
do_test_pending();
}
function test_nested_breakpoint()
@ -47,7 +56,7 @@ function test_nested_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_second_child_skip_breakpoint();
});
});
do_test_pending();
}
function test_second_child_skip_breakpoint()
@ -47,7 +56,7 @@ function test_second_child_skip_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_child_skip_breakpoint();
});
});
do_test_pending();
}
function test_child_skip_breakpoint()
@ -47,7 +56,7 @@ function test_child_skip_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});

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

@ -8,19 +8,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_remove_breakpoint();
});
});
do_test_pending();
}
function test_remove_breakpoint()
@ -73,5 +82,5 @@ function test_remove_breakpoint()
if (!done) {
do_check_true(false);
}
finishClient(gClient);
gClient.close(gCallback);
}

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_child_breakpoint();
});
});
do_test_pending();
}
function test_child_breakpoint()
@ -51,7 +60,7 @@ function test_child_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});
});

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_child_breakpoint();
});
});
do_test_pending();
}
function test_child_breakpoint()
@ -52,7 +61,7 @@ function test_child_breakpoint()
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
gClient.close(gCallback);
});
});
});

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

@ -12,20 +12,30 @@ var gClient;
var gThreadClient;
var gPath = getFilePath('test_breakpoint-12.js');
var gBpActor;
var gCount = 1;
var gCount;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
gCount = 1;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_child_skip_breakpoint();
});
});
do_test_pending();
}
function test_child_skip_breakpoint()
@ -88,7 +98,9 @@ function set_breakpoints(location) {
});
gThreadClient.resume(function () {
// Give any remaining breakpoints a chance to trigger.
do_timeout(1000, finishClient.bind(null, gClient));
do_timeout(1000, function () {
gClient.close(gCallback);
});
});
});

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_simple_breakpoint();
});
});
do_test_pending();
}
function test_simple_breakpoint()
@ -70,7 +79,7 @@ function test_simple_breakpoint()
do_check_eq(aPacket.why.type, "resumeLimit");
// Remove the breakpoint and finish.
bpClient.remove(() => gThreadClient.resume(() => finishClient(gClient)));
bpClient.remove(() => gThreadClient.resume(() => gClient.close(gCallback)));
});
// Step past the debugger statement.

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

@ -9,19 +9,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_simple_breakpoint();
});
});
do_test_pending();
}
function test_simple_breakpoint()
@ -69,7 +78,7 @@ function test_simple_breakpoint()
do_check_eq(aPacket.why.type, "resumeLimit");
// Remove the breakpoint and finish.
bpClient.remove(() => gThreadClient.resume(() => finishClient(gClient)));
bpClient.remove(() => gThreadClient.resume(() => gClient.close(gCallback)));
});
// Step past the debugger statement.

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

@ -8,19 +8,28 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-stack", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_same_breakpoint();
});
});
do_test_pending();
}
function test_same_breakpoint()
@ -44,7 +53,7 @@ function test_same_breakpoint()
gThreadClient.setBreakpoint(location, function (aResponse, secondBpClient) {
do_check_eq(bpClient.actor, secondBpClient.actor,
"Should get the same actor column breakpoints");
finishClient(gClient);
gClient.close(gCallback);
});
});
});

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

@ -8,12 +8,22 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-breakpoints");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-breakpoints", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient,
"test-breakpoints",
@ -22,7 +32,6 @@ function run_test()
test_column_breakpoint();
});
});
do_test_pending();
}
function test_column_breakpoint()
@ -53,7 +62,7 @@ function test_column_breakpoint()
if (++timesBreakpointHit === 3) {
gThreadClient.removeListener("paused", _onPaused);
bpClient.remove(function (aResponse) {
gThreadClient.resume(() => finishClient(gClient));
gThreadClient.resume(() => gClient.close(gCallback));
});
} else {
gThreadClient.resume();

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

@ -9,19 +9,26 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-breakpoints");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
run_test_with_server(DebuggerServer, do_test_finished);
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-breakpoints", aServer);
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function() {
attachTestTabAndResume(gClient, "test-breakpoints", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
test_breakpoints_columns();
});
});
do_test_pending();
}
const URL = "http://example.com/benderbendingrodriguez.js";
@ -104,7 +111,7 @@ function test_remove_one(aFirst, aSecond) {
do_check_true(hitSecond,
"We should still hit `second`, but not `first`.");
finishClient(gClient);
gClient.close(gCallback);
return;
}

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

@ -9,13 +9,23 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gCallback;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-breakpoints");
run_test_with_server(DebuggerServer, function () {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
});
do_test_pending();
};
function run_test_with_server(aServer, aCallback)
{
gCallback = aCallback;
initTestDebuggerServer(aServer);
gDebuggee = addTestGlobal("test-breakpoints", aServer);
gDebuggee.console = { log: x => void x };
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient = new DebuggerClient(aServer.connectPipe());
gClient.connect(function () {
attachTestTabAndResume(gClient,
"test-breakpoints",
@ -24,7 +34,6 @@ function run_test()
setUpCode();
});
});
do_test_pending();
}
const URL = "test.js";
@ -69,5 +78,5 @@ function testDbgStatement(event, { why }) {
// Not break on another offset from the same line (that isn't an entry point
// to the line)
do_check_neq(why.type, "breakpoint");
finishClient(gClient);
gClient.close(gCallback);
}