Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector-enabled / sources / debugger / script-window-close-breakpoint.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5
6 <script>
7
8 function doClose()
9 {
10     window.close();
11 }
12
13 function onload()
14 {
15     if (window.testRunner) {
16         testRunner.dumpAsText();
17         testRunner.waitUntilDone();
18         testRunner.showWebInspector();
19     }
20     runTest();
21 }
22
23 var test = function()
24 {
25     // This is needed because Inspector.addResult() uses output() which places elements
26     //   into the <body> which gets disposed along with the window
27     function log(message) {
28         InspectorTest.evaluateInPage("console.log(unescape('"+ escape(message) +"'));");
29     }
30
31     log("Starting test");
32     WebInspector.inspectorView.showPanel("sources");
33     var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
34     InspectorTest.startDebuggerTest(testCloseBreakpoint);
35
36     function testCloseBreakpoint(next)
37     {
38         log("Setting breakpoint");
39         pane._setBreakpoint('instrumentation:close');
40
41         log("Calling window.close()");
42         InspectorTest.waitUntilPaused(paused);
43         InspectorTest.evaluateInPage("doClose()");
44
45         function paused(callFrames)
46         {
47             log("Paused in breakpoint");
48             // get the first stack frame
49             log(InspectorTest.captureStackTraceIntoString(callFrames).split('\n')[1].trim());
50
51             pane._removeBreakpoint('instrumentation:close');
52             InspectorTest.completeDebuggerTest();
53             // After this point execution will resume and the window will close
54         }
55     }
56 }
57 </script>
58 </head>
59 <body onload="onload()">
60 <p>Tests the window close breakpoint.
61 </p>
62 </body>
63 </html>