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: third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-await/async-callstack-async-await2.html

Issue 2099723002: [LayoutTests] Split up inspector/sources/debugger-async/async-await/async-callstack-async-await.html (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip tests except in virtual suite Created 4 years, 5 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../../../http/tests/inspector/debugger-test.js"></script>
5 <script> 5 <script>
6 6
7 function timeoutPromise(value, ms) 7 function timeoutPromise(value, ms)
8 { 8 {
9 return new Promise(function promiseCallback(resolve, reject) { 9 return new Promise(function promiseCallback(resolve, reject) {
10 function resolvePromise() 10 function resolvePromise()
(...skipping 27 matching lines...) Expand all
38 return new Promise(resolveCallback); 38 return new Promise(resolveCallback);
39 } 39 }
40 40
41 function testFunction() 41 function testFunction()
42 { 42 {
43 setTimeout(testFunctionTimeout, 0); 43 setTimeout(testFunctionTimeout, 0);
44 } 44 }
45 45
46 function testFunctionTimeout() 46 function testFunctionTimeout()
47 { 47 {
48 var functions = [doTestPromiseConstructor, doTestSettledPromisesResolved, do TestSettledPromisesRejected, doTestChainedPromises, doTestChainedPromisesJSON, d oTestPromiseAll, doTestThrowFromChain, doTestRejectFromChain, doTestPromiseResol ve, doTestPromiseReject]; 48 var functions = [doTestPromiseAll, doTestThrowFromChain, doTestRejectFromCha in, doTestPromiseResolve, doTestPromiseReject];
49 for (var i = 0; i < functions.length; ++i) 49 for (var i = 0; i < functions.length; ++i)
50 functions[i](); 50 functions[i]();
51 } 51 }
52 52
53 function thenCallback(value) 53 function thenCallback(value)
54 { 54 {
55 debugger; 55 debugger;
56 } 56 }
57 57
58 function errorCallback(error) 58 function errorCallback(error)
59 { 59 {
60 debugger; 60 debugger;
61 } 61 }
62 62
63 async function doTestPromiseConstructor()
64 {
65 try {
66 let result = await new Promise(function promiseCallback(resolve, reject) {
67 resolve(1);
68 debugger;
69 });
70 thenCallback(result);
71 } catch (e) {
72 errorCallback(e);
73 }
74 }
75
76 async function doTestSettledPromisesResolved()
77 {
78 try {
79 let value = await settledPromise("resolved");
80 thenCallback(value);
81 } catch (e) {
82 errorCallback(e);
83 }
84 }
85
86 async function doTestSettledPromisesRejected()
87 {
88 try {
89 let value = await settledPromise(new Error("rejected"));
90 thenCallback(value);
91 } catch (e) {
92 errorCallback(e);
93 }
94 }
95
96 async function doTestChainedPromises()
97 {
98 try {
99 await timeoutPromise(1);
100 debugger;
101 await timeoutPromise(2);
102 debugger;
103 await 3;
104 debugger;
105 await settledPromise(4);
106 debugger;
107 thenCallback(await timeoutPromise(5));
108 } catch (e) {
109 errorCallback(e);
110 }
111 }
112
113 async function doTestChainedPromisesJSON()
114 {
115 try {
116 let one = await timeoutPromise(1);
117 let stringify = await JSON.stringify(one);
118 let parse = await JSON.parse(stringify);
119 thenCallback(parse);
120 } catch (e) {
121 errorCallback(e);
122 }
123 }
124
125 async function doTestPromiseAll() 63 async function doTestPromiseAll()
126 { 64 {
127 try { 65 try {
128 let all = await Promise.all([11, 22, 33, 44, 55].map(timeoutPromise)); 66 let all = await Promise.all([11, 22, 33, 44, 55].map(timeoutPromise));
129 thenCallback(all); 67 thenCallback(all);
130 } catch (e) { 68 } catch (e) {
131 errorCallback(e); 69 errorCallback(e);
132 } 70 }
133 } 71 }
134 72
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 try { 125 try {
188 let result = await Promise.reject(new Error("2")) 126 let result = await Promise.reject(new Error("2"))
189 thenCallback(result); 127 thenCallback(result);
190 } catch (e) { 128 } catch (e) {
191 errorCallback(e); 129 errorCallback(e);
192 } 130 }
193 } 131 }
194 132
195 var test = function() 133 var test = function()
196 { 134 {
197 var totalDebuggerStatements = 15; 135 var totalDebuggerStatements = 5;
198 var maxAsyncCallStackDepth = 5; 136 var maxAsyncCallStackDepth = 5;
199 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt ackDepth); 137 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt ackDepth);
200 } 138 }
201 139
202 </script> 140 </script>
203 </head> 141 </head>
204 142
205 <body onload="runTest()"> 143 <body onload="runTest()">
206 <p> 144 <p>
207 Tests asynchronous call stacks for async functions. 145 Tests asynchronous call stacks for async functions.
208 </p> 146 </p>
209 147
210 </body> 148 </body>
211 </html> 149 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698