2013-09-13 06:23:19 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests if a warning is shown in the inspector when debugger is paused.
|
2013-01-09 01:32:35 -08:00
|
|
|
*/
|
|
|
|
|
2013-09-13 06:23:19 -07:00
|
|
|
const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
|
|
|
|
|
|
|
|
let gTab, gDebuggee, gPanel, gDebugger;
|
|
|
|
let gTarget, gToolbox;
|
2013-01-09 01:32:35 -08:00
|
|
|
|
|
|
|
function test() {
|
2013-09-13 06:23:19 -07:00
|
|
|
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
2013-01-09 01:32:35 -08:00
|
|
|
gTab = aTab;
|
2013-09-13 06:23:19 -07:00
|
|
|
gDebuggee = aDebuggee;
|
|
|
|
gPanel = aPanel;
|
|
|
|
gDebugger = gPanel.panelWin;
|
|
|
|
gTarget = gPanel.target;
|
|
|
|
gToolbox = gPanel._toolbox;
|
2013-01-09 01:32:35 -08:00
|
|
|
|
|
|
|
testPause();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testPause() {
|
2013-09-13 06:23:19 -07:00
|
|
|
gDebugger.gThreadClient.addOneTimeListener("paused", () => {
|
|
|
|
ok(gTarget.isThreadPaused,
|
|
|
|
"target.isThreadPaused has been updated to true.");
|
2013-01-09 01:32:35 -08:00
|
|
|
|
2013-09-13 06:23:19 -07:00
|
|
|
gToolbox.once("inspector-selected", testNotificationIsUp1);
|
|
|
|
gToolbox.selectTool("inspector");
|
2013-01-09 01:32:35 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
|
|
|
gDebugger.document.getElementById("resume"),
|
|
|
|
gDebugger);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testNotificationIsUp1() {
|
|
|
|
let notificationBox = gToolbox.getNotificationBox();
|
|
|
|
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
2013-09-13 06:23:19 -07:00
|
|
|
|
|
|
|
ok(notification,
|
|
|
|
"Inspector notification is present (1).");
|
|
|
|
|
2013-01-09 01:32:35 -08:00
|
|
|
gToolbox.once("jsdebugger-selected", testNotificationIsHidden);
|
|
|
|
gToolbox.selectTool("jsdebugger");
|
|
|
|
}
|
|
|
|
|
|
|
|
function testNotificationIsHidden() {
|
|
|
|
let notificationBox = gToolbox.getNotificationBox();
|
|
|
|
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
2013-09-13 06:23:19 -07:00
|
|
|
|
|
|
|
ok(!notification,
|
|
|
|
"Inspector notification is hidden (2).");
|
|
|
|
|
2013-01-09 01:32:35 -08:00
|
|
|
gToolbox.once("inspector-selected", testNotificationIsUp2);
|
|
|
|
gToolbox.selectTool("inspector");
|
|
|
|
}
|
|
|
|
|
|
|
|
function testNotificationIsUp2() {
|
|
|
|
let notificationBox = gToolbox.getNotificationBox();
|
|
|
|
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
2013-09-13 06:23:19 -07:00
|
|
|
|
|
|
|
ok(notification,
|
|
|
|
"Inspector notification is present again (3).");
|
|
|
|
|
2013-01-09 01:32:35 -08:00
|
|
|
testResume();
|
|
|
|
}
|
|
|
|
|
|
|
|
function testResume() {
|
2013-09-13 06:23:19 -07:00
|
|
|
gDebugger.gThreadClient.addOneTimeListener("resumed", () => {
|
|
|
|
ok(!gTarget.isThreadPaused,
|
|
|
|
"target.isThreadPaused has been updated to false.");
|
2013-01-09 01:32:35 -08:00
|
|
|
|
2013-09-13 06:23:19 -07:00
|
|
|
let notificationBox = gToolbox.getNotificationBox();
|
|
|
|
let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
|
2013-01-09 01:32:35 -08:00
|
|
|
|
2013-09-13 06:23:19 -07:00
|
|
|
ok(!notification,
|
|
|
|
"Inspector notification was removed once debugger resumed.");
|
|
|
|
|
|
|
|
closeDebuggerAndFinish(gPanel);
|
2013-01-09 01:32:35 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
|
|
|
gDebugger.document.getElementById("resume"),
|
|
|
|
gDebugger);
|
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(function() {
|
|
|
|
gTab = null;
|
2013-09-13 06:23:19 -07:00
|
|
|
gDebuggee = null;
|
|
|
|
gPanel = null;
|
2013-01-09 01:32:35 -08:00
|
|
|
gDebugger = null;
|
|
|
|
gTarget = null;
|
2013-09-13 06:23:19 -07:00
|
|
|
gToolbox = null;
|
2013-01-09 01:32:35 -08:00
|
|
|
});
|