browser/devtools/debugger/test/browser_dbg_pause-warning.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests if a warning is shown in the inspector when debugger is paused.
michael@0 6 */
michael@0 7
michael@0 8 const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
michael@0 9
michael@0 10 let gTab, gDebuggee, gPanel, gDebugger;
michael@0 11 let gTarget, gToolbox;
michael@0 12
michael@0 13 function test() {
michael@0 14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
michael@0 15 gTab = aTab;
michael@0 16 gDebuggee = aDebuggee;
michael@0 17 gPanel = aPanel;
michael@0 18 gDebugger = gPanel.panelWin;
michael@0 19 gTarget = gPanel.target;
michael@0 20 gToolbox = gPanel._toolbox;
michael@0 21
michael@0 22 testPause();
michael@0 23 });
michael@0 24 }
michael@0 25
michael@0 26 function testPause() {
michael@0 27 gDebugger.gThreadClient.addOneTimeListener("paused", () => {
michael@0 28 ok(gTarget.isThreadPaused,
michael@0 29 "target.isThreadPaused has been updated to true.");
michael@0 30
michael@0 31 gToolbox.once("inspector-selected", testNotificationIsUp1);
michael@0 32 gToolbox.selectTool("inspector");
michael@0 33 });
michael@0 34
michael@0 35 EventUtils.sendMouseEvent({ type: "mousedown" },
michael@0 36 gDebugger.document.getElementById("resume"),
michael@0 37 gDebugger);
michael@0 38 }
michael@0 39
michael@0 40 function testNotificationIsUp1() {
michael@0 41 let notificationBox = gToolbox.getNotificationBox();
michael@0 42 let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
michael@0 43
michael@0 44 ok(notification,
michael@0 45 "Inspector notification is present (1).");
michael@0 46
michael@0 47 gToolbox.once("jsdebugger-selected", testNotificationIsHidden);
michael@0 48 gToolbox.selectTool("jsdebugger");
michael@0 49 }
michael@0 50
michael@0 51 function testNotificationIsHidden() {
michael@0 52 let notificationBox = gToolbox.getNotificationBox();
michael@0 53 let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
michael@0 54
michael@0 55 ok(!notification,
michael@0 56 "Inspector notification is hidden (2).");
michael@0 57
michael@0 58 gToolbox.once("inspector-selected", testNotificationIsUp2);
michael@0 59 gToolbox.selectTool("inspector");
michael@0 60 }
michael@0 61
michael@0 62 function testNotificationIsUp2() {
michael@0 63 let notificationBox = gToolbox.getNotificationBox();
michael@0 64 let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
michael@0 65
michael@0 66 ok(notification,
michael@0 67 "Inspector notification is present again (3).");
michael@0 68
michael@0 69 testResume();
michael@0 70 }
michael@0 71
michael@0 72 function testResume() {
michael@0 73 gDebugger.gThreadClient.addOneTimeListener("resumed", () => {
michael@0 74 ok(!gTarget.isThreadPaused,
michael@0 75 "target.isThreadPaused has been updated to false.");
michael@0 76
michael@0 77 let notificationBox = gToolbox.getNotificationBox();
michael@0 78 let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
michael@0 79
michael@0 80 ok(!notification,
michael@0 81 "Inspector notification was removed once debugger resumed.");
michael@0 82
michael@0 83 closeDebuggerAndFinish(gPanel);
michael@0 84 });
michael@0 85
michael@0 86 EventUtils.sendMouseEvent({ type: "mousedown" },
michael@0 87 gDebugger.document.getElementById("resume"),
michael@0 88 gDebugger);
michael@0 89 }
michael@0 90
michael@0 91 registerCleanupFunction(function() {
michael@0 92 gTab = null;
michael@0 93 gDebuggee = null;
michael@0 94 gPanel = null;
michael@0 95 gDebugger = null;
michael@0 96 gTarget = null;
michael@0 97 gToolbox = null;
michael@0 98 });

mercurial