Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: LayoutTests/inspector/sources/debugger/skip-pauses-until-reload.html

Issue 1153923005: DevTools: shard inspector/debugger tests for faster execution. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
7
8 function testFunction()
9 {
10 console.log("Begin");
11 debugger; // Reload follows, nothing below should break.
12 console.log("Middle: Breakpoint 1"); // Breakpoint
13 console.log("Middle: Breakpoint 2"); // Breakpoint
14 console.assert(false, "Assertion failed!");
15 console.error("Some console.error message");
16 debugger; // Should skip this also.
17 var element = document.getElementById("element");
18 var parent = element.parentElement;
19 var child = document.createElement("span");
20 element.setAttribute("foo", "bar"); // DOM breakpoint: AttributeModified
21 element.appendChild(child); // DOM breakpoint: SubtreeModified
22 parent.removeChild(element); // DOM breakpoint: NodeRemoved
23 parent.appendChild(element);
24 element.click(); // Event breakpoint
25 console.log("End");
26 // Should be last.
27 eval("throwException()");
28 }
29
30 function throwException()
31 {
32 function inner()
33 {
34 try {
35 if (window.foo === 1)
36 throw new Error("error message");
37 } finally {
38 ++window.foo;
39 }
40 }
41 try {
42 window.foo = 1;
43 inner();
44 } finally {
45 ++window.foo;
46 }
47 }
48
49 function test()
50 {
51 InspectorTest.startDumpingProtocolMessages();
52 InspectorTest.startDebuggerTest(step1);
53
54 function step1()
55 {
56 InspectorTest.showScriptSource("skip-pauses-until-reload.html", didShowS criptSource);
57 }
58
59 function didShowScriptSource(sourceFrame)
60 {
61 InspectorTest.addResult("Script source was shown.");
62 InspectorTest.addResult("Set up breakpoints.");
63 InspectorTest.setBreakpoint(sourceFrame, 11, "", true);
64 InspectorTest.setBreakpoint(sourceFrame, 12, "", true);
65 InspectorTest.addResult("Set up to pause on all exceptions.");
66 // FIXME: Test is flaky with PauseOnAllExceptions due to races in debugg er.
67 InspectorTest.DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerMo del.PauseOnExceptionsState.DontPauseOnExceptions);
68 InspectorTest.nodeWithId("element", didResolveNode);
69 testRunner.logToStderr("didShowScriptSource");
70 }
71
72 function didResolveNode(node)
73 {
74 testRunner.logToStderr("didResolveNode");
75 var pane = WebInspector.domBreakpointsSidebarPane;
76 InspectorTest.addResult("Set up DOM breakpoints.");
77 pane._setBreakpoint(node, pane._breakpointTypes.SubtreeModified, true);
78 pane._setBreakpoint(node, pane._breakpointTypes.AttributeModified, true) ;
79 pane._setBreakpoint(node, pane._breakpointTypes.NodeRemoved, true);
80 setUpEventBreakpoints();
81 }
82
83 function setUpEventBreakpoints()
84 {
85 testRunner.logToStderr("setUpEventBreakpoints");
86 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpo ints;
87 InspectorTest.addResult("Set up Event breakpoints.");
88 pane._setBreakpoint("listener:click");
89 InspectorTest.runAfterPendingDispatches(didSetUp);
90 }
91
92 function didSetUp()
93 {
94 testRunner.logToStderr("didSetUp");
95 InspectorTest.addResult("Did set up.");
96 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
97 }
98
99 function didPause(callFrames)
100 {
101 testRunner.logToStderr("didPause");
102 InspectorTest.captureStackTrace(callFrames);
103 InspectorTest.DebuggerAgent.setSkipAllPauses(true, didSetSkipAllPauses);
104 }
105
106 function didSetSkipAllPauses()
107 {
108 testRunner.logToStderr("didSetSkipAllPauses");
109 InspectorTest.addResult("Set up to skip all pauses.");
110 doReloadPage();
111 }
112
113 function doReloadPage()
114 {
115 testRunner.logToStderr("doReloadPage");
116 InspectorTest.addResult("Reloading the page...");
117 InspectorTest.waitUntilPausedNextTime(didPauseAfterReload);
118 InspectorTest.reloadPage(didReloadPage);
119 }
120
121 function didReloadPage()
122 {
123 testRunner.logToStderr("didReloadPage");
124 InspectorTest.addResult("PASS: Reloaded without hitting breakpoints.");
125 completeTest();
126 }
127
128 function didPauseAfterReload(callFrames)
129 {
130 testRunner.logToStderr("didPauseAfterReload");
131 InspectorTest.addResult("FAIL: Should not pause while reloading the page !");
132 InspectorTest.captureStackTrace(callFrames);
133 InspectorTest.waitUntilPausedNextTime(didPauseAfterReload);
134 InspectorTest.resumeExecution();
135 }
136
137 function completeTest()
138 {
139 testRunner.logToStderr("completeTest");
140 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpo ints;
141 pane._removeBreakpoint("listener:click");
142 InspectorTest.completeDebuggerTest();
143 }
144 };
145
146 </script>
147
148 </head>
149
150 <body onload="runTest()">
151 <p>Tests that 'skip all pauses' mode blocks breakpoint and gets cancelled right at page reload.
152 </p>
153
154 <div id="element" onclick="return 0;"></div>
155 </body>
156 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698