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

Side by Side Diff: LayoutTests/inspector/sources/debugger/async-callstack-scopes.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/debugger-test.js"></script>
5 <script>
6
7 function makeClosure(n, callback, withScope)
8 {
9 var makeClosureLocalVar = 'local.' + n;
10 return function innerFunction(x) {
11 var innerFunctionLocalVar = x + 2;
12 try {
13 throw new Error("An exception");
14 } catch (e) {
15 e.toString();
16 if (withScope) {
17 with (withScope) {
18 callback();
19 }
20 } else {
21 callback();
22 }
23 }
24 return n + makeClosureLocalVar + x + innerFunctionLocalVar;
25 }
26 }
27
28 function testFunction()
29 {
30 var delay1 = 0;
31 setTimeout(timeout1, delay1);
32 }
33
34 function timeout1()
35 {
36 var localInTimeout1 = "timeout1";
37 function innerTimeout1()
38 {
39 var localInInnerTimeout1 = "innerTimeout1";
40 setTimeout(timeout2, Number(localInInnerTimeout1 + localInTimeout1) || 0 );
41 }
42 makeClosure(1, innerTimeout1, { foo: "bar1", __proto__: null })(100);
43 }
44
45 function timeout2()
46 {
47 var localInTimeout2 = "timeout2";
48 function innerTimeout2()
49 {
50 var localInInnerTimeout2 = "innerTimeout2";
51 debugger;
52 }
53 makeClosure(2, innerTimeout2, { foo: "bar2", __proto__: null })(200);
54 }
55
56 function test()
57 {
58 var maxAsyncCallStackDepth = 4;
59
60 InspectorTest.setQuiet(true);
61 InspectorTest.startDebuggerTest(step1);
62
63 function step1()
64 {
65 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDept h, step2);
66 }
67
68 function step2()
69 {
70 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
71 }
72
73 function didPause()
74 {
75 var callStackPane = WebInspector.panels.sources.sidebarPanes.callstack;
76 var scopeChainPane = WebInspector.panels.sources.sidebarPanes.scopechain ;
77 InspectorTest.addResult("Dumping call frames with scope chains:\n");
78 printNextCallFrame();
79
80 function printNextCallFrame()
81 {
82 var index = callStackPane._selectedCallFrameIndex();
83 InspectorTest.assertGreaterOrEqual(index, 0);
84 var frame = callStackPane.callFrames[index];
85 InspectorTest.addResult((index + 1) + ") " + frame.title() + " " + f rame.subtitle());
86 expandScopeChain();
87 }
88
89 function expandScopeChain()
90 {
91 // Expand all but global scopes. Expanding global scope takes too lo ng
92 // so we keep it collapsed.
93 var sections = scopeChainPane._sections;
94 // global scope is always the last one.
95 for (var i = 0; i < sections.length - 1; ++i)
96 sections[i].expand();
97 InspectorTest.runAfterPendingDispatches(printScopeChain);
98 }
99
100 function printScopeChain()
101 {
102 InspectorTest.dumpScopeVariablesSidebarPane();
103 InspectorTest.addResult("");
104
105 // Dump up to the testFunction() - we don't care what was before.
106 var index = callStackPane._selectedCallFrameIndex();
107 var frame = callStackPane.callFrames[index];
108 if (frame.title() !== "testFunction" && callStackPane._selectNextCal lFrameOnStack())
109 InspectorTest.runAfterPendingDispatches(printNextCallFrame);
110 else
111 InspectorTest.completeDebuggerTest();
112 }
113 }
114 }
115
116 </script>
117 </head>
118
119 <body onload="runTest()">
120 <input type='button' onclick='testFunction()' value='Test'/>
121 <p>
122 Test that sections representing scopes are expandable and contain correct data f or async call frames.
123 </p>
124 </body>
125 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698