1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_pause-warning.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,98 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Tests if a warning is shown in the inspector when debugger is paused. 1.9 + */ 1.10 + 1.11 +const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; 1.12 + 1.13 +let gTab, gDebuggee, gPanel, gDebugger; 1.14 +let gTarget, gToolbox; 1.15 + 1.16 +function test() { 1.17 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.18 + gTab = aTab; 1.19 + gDebuggee = aDebuggee; 1.20 + gPanel = aPanel; 1.21 + gDebugger = gPanel.panelWin; 1.22 + gTarget = gPanel.target; 1.23 + gToolbox = gPanel._toolbox; 1.24 + 1.25 + testPause(); 1.26 + }); 1.27 +} 1.28 + 1.29 +function testPause() { 1.30 + gDebugger.gThreadClient.addOneTimeListener("paused", () => { 1.31 + ok(gTarget.isThreadPaused, 1.32 + "target.isThreadPaused has been updated to true."); 1.33 + 1.34 + gToolbox.once("inspector-selected", testNotificationIsUp1); 1.35 + gToolbox.selectTool("inspector"); 1.36 + }); 1.37 + 1.38 + EventUtils.sendMouseEvent({ type: "mousedown" }, 1.39 + gDebugger.document.getElementById("resume"), 1.40 + gDebugger); 1.41 +} 1.42 + 1.43 +function testNotificationIsUp1() { 1.44 + let notificationBox = gToolbox.getNotificationBox(); 1.45 + let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); 1.46 + 1.47 + ok(notification, 1.48 + "Inspector notification is present (1)."); 1.49 + 1.50 + gToolbox.once("jsdebugger-selected", testNotificationIsHidden); 1.51 + gToolbox.selectTool("jsdebugger"); 1.52 +} 1.53 + 1.54 +function testNotificationIsHidden() { 1.55 + let notificationBox = gToolbox.getNotificationBox(); 1.56 + let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); 1.57 + 1.58 + ok(!notification, 1.59 + "Inspector notification is hidden (2)."); 1.60 + 1.61 + gToolbox.once("inspector-selected", testNotificationIsUp2); 1.62 + gToolbox.selectTool("inspector"); 1.63 +} 1.64 + 1.65 +function testNotificationIsUp2() { 1.66 + let notificationBox = gToolbox.getNotificationBox(); 1.67 + let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); 1.68 + 1.69 + ok(notification, 1.70 + "Inspector notification is present again (3)."); 1.71 + 1.72 + testResume(); 1.73 +} 1.74 + 1.75 +function testResume() { 1.76 + gDebugger.gThreadClient.addOneTimeListener("resumed", () => { 1.77 + ok(!gTarget.isThreadPaused, 1.78 + "target.isThreadPaused has been updated to false."); 1.79 + 1.80 + let notificationBox = gToolbox.getNotificationBox(); 1.81 + let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); 1.82 + 1.83 + ok(!notification, 1.84 + "Inspector notification was removed once debugger resumed."); 1.85 + 1.86 + closeDebuggerAndFinish(gPanel); 1.87 + }); 1.88 + 1.89 + EventUtils.sendMouseEvent({ type: "mousedown" }, 1.90 + gDebugger.document.getElementById("resume"), 1.91 + gDebugger); 1.92 +} 1.93 + 1.94 +registerCleanupFunction(function() { 1.95 + gTab = null; 1.96 + gDebuggee = null; 1.97 + gPanel = null; 1.98 + gDebugger = null; 1.99 + gTarget = null; 1.100 + gToolbox = null; 1.101 +});