From a50cf14136f6082872da83977ff74e7c514d55ad Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Thu, 15 May 2014 16:47:12 +0200 Subject: [PATCH] Bug 1003095 - Refactor breakpoint tests to run against multiple loaders;r=past --- .../devtools/server/tests/unit/head_dbg.js | 4 +++- .../server/tests/unit/test_breakpoint-01.js | 20 +++++++++++----- .../server/tests/unit/test_breakpoint-02.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-03.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-04.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-05.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-06.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-07.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-08.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-09.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-10.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-11.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-12.js | 24 ++++++++++++++----- .../server/tests/unit/test_breakpoint-13.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-14.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-15.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-16.js | 19 +++++++++++---- .../server/tests/unit/test_breakpoint-17.js | 17 +++++++++---- .../server/tests/unit/test_breakpoint-18.js | 19 +++++++++++---- 19 files changed, 257 insertions(+), 93 deletions(-) diff --git a/toolkit/devtools/server/tests/unit/head_dbg.js b/toolkit/devtools/server/tests/unit/head_dbg.js index 1e55104e6a26..91b48ec384de 100644 --- a/toolkit/devtools/server/tests/unit/head_dbg.js +++ b/toolkit/devtools/server/tests/unit/head_dbg.js @@ -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. diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-01.js b/toolkit/devtools/server/tests/unit/test_breakpoint-01.js index 073bdc3ca756..68f207ae097b 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-01.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-01.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-02.js b/toolkit/devtools/server/tests/unit/test_breakpoint-02.js index f9afe09d752e..d8c13bf16509 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-02.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-02.js @@ -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); }); }); } diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-03.js b/toolkit/devtools/server/tests/unit/test_breakpoint-03.js index b58e979053b1..824a79aff666 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-03.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-03.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-04.js b/toolkit/devtools/server/tests/unit/test_breakpoint-04.js index 2c4409570ec9..39dd0cba8734 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-04.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-04.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-05.js b/toolkit/devtools/server/tests/unit/test_breakpoint-05.js index 7c0b94d066c3..c1a23b6c89bb 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-05.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-05.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-06.js b/toolkit/devtools/server/tests/unit/test_breakpoint-06.js index eade082680f2..470f867eb9e7 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-06.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-06.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-07.js b/toolkit/devtools/server/tests/unit/test_breakpoint-07.js index 41ad26c1d291..2f333f404c6c 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-07.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-07.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-08.js b/toolkit/devtools/server/tests/unit/test_breakpoint-08.js index 54feb2fafbd6..802e66863816 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-08.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-08.js @@ -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); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-09.js b/toolkit/devtools/server/tests/unit/test_breakpoint-09.js index 58a97bf544eb..ea2c05e74501 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-09.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-09.js @@ -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); } diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-10.js b/toolkit/devtools/server/tests/unit/test_breakpoint-10.js index 2bb1fb594593..35a03079063b 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-10.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-10.js @@ -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); }); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-11.js b/toolkit/devtools/server/tests/unit/test_breakpoint-11.js index 93a7b4eba745..d3a6765ebd7d 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-11.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-11.js @@ -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); }); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-12.js b/toolkit/devtools/server/tests/unit/test_breakpoint-12.js index 25cb80a5188e..12dcba5da6dd 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-12.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-12.js @@ -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); + }); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-13.js b/toolkit/devtools/server/tests/unit/test_breakpoint-13.js index b8dbabb46bd7..2a540674ca0d 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-13.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-13.js @@ -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. diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-14.js b/toolkit/devtools/server/tests/unit/test_breakpoint-14.js index 5e9bdfab2c1d..650e0b834613 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-14.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-14.js @@ -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. diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-15.js b/toolkit/devtools/server/tests/unit/test_breakpoint-15.js index e013896f4b1b..c6ad0815b16a 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-15.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-15.js @@ -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); }); }); }); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-16.js b/toolkit/devtools/server/tests/unit/test_breakpoint-16.js index 5be0f798402f..031a123d1068 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-16.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-16.js @@ -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(); diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-17.js b/toolkit/devtools/server/tests/unit/test_breakpoint-17.js index 5e28e5c724c0..31cbbb61437c 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-17.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-17.js @@ -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; } diff --git a/toolkit/devtools/server/tests/unit/test_breakpoint-18.js b/toolkit/devtools/server/tests/unit/test_breakpoint-18.js index fb25905aac38..8f3d1106566c 100644 --- a/toolkit/devtools/server/tests/unit/test_breakpoint-18.js +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-18.js @@ -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); }