OLD | NEW |
(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 timeoutPromise(value, ms) |
| 8 { |
| 9 return new Promise(function promiseCallback(resolve, reject) { |
| 10 function resolvePromise() |
| 11 { |
| 12 resolve(value); |
| 13 } |
| 14 function rejectPromise() |
| 15 { |
| 16 reject(value); |
| 17 } |
| 18 if (value instanceof Error) |
| 19 setTimeout(rejectPromise, ms || 0); |
| 20 else |
| 21 setTimeout(resolvePromise, ms || 0); |
| 22 }); |
| 23 } |
| 24 |
| 25 function testFunction() |
| 26 { |
| 27 setTimeout(testFunctionTimeout, 0); |
| 28 } |
| 29 |
| 30 function testFunctionTimeout() |
| 31 { |
| 32 var functions = [doTestPromiseResolveAndReject]; |
| 33 for (var i = 0; i < functions.length; ++i) |
| 34 functions[i](); |
| 35 } |
| 36 |
| 37 function thenCallback(value) |
| 38 { |
| 39 debugger; |
| 40 } |
| 41 |
| 42 function errorCallback(error) |
| 43 { |
| 44 debugger; |
| 45 } |
| 46 |
| 47 function doTestPromiseResolveAndReject() |
| 48 { |
| 49 timeoutPromise(1).then(thenCallback, errorCallback); |
| 50 timeoutPromise(Error("2")).then(thenCallback, errorCallback); |
| 51 } |
| 52 |
| 53 var test = function() |
| 54 { |
| 55 var totalDebuggerStatements = 2; |
| 56 var maxAsyncCallStackDepth = 4; |
| 57 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt
ackDepth); |
| 58 } |
| 59 |
| 60 </script> |
| 61 </head> |
| 62 |
| 63 <body onload="runTest()"> |
| 64 <p> |
| 65 Tests asynchronous call stacks for SIMPLE Promises. |
| 66 </p> |
| 67 |
| 68 </body> |
| 69 </html> |
OLD | NEW |