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 testFunction() | |
8 { | |
9 var promise = new Promise(function promiseConstructor(resolve, reject) { | |
10 resolve("Resolved!"); | |
11 }); | |
12 promise | |
13 .then(thenCallback, errorCallback) | |
14 .then(thenCallback2, errorCallback); | |
15 } | |
16 | |
17 function thenCallback() { } | |
18 | |
19 function thenCallback2() | |
20 { | |
21 debugger; | |
22 } | |
23 | |
24 function errorCallback() { } | |
25 | |
26 var test = function () | |
27 { | |
28 var output = []; | |
29 | |
30 InspectorTest.startDebuggerTest(step1); | |
31 | |
32 function step1() | |
33 { | |
34 DebuggerAgent.enablePromiseTracker(); | |
35 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); | |
36 } | |
37 | |
38 function step2() | |
39 { | |
40 DebuggerAgent.getPromises(didGetPromises); | |
41 } | |
42 | |
43 function didGetPromises(error, response) { | |
aandrey
2014/09/02 14:34:49
new line before {
Alexandra Mikhaylova
2014/09/03 14:28:54
Done.
aandrey
2014/09/03 14:57:57
*before* {, not after
Alexandra Mikhaylova
2014/09/03 15:01:20
Done.
| |
44 function comparePromiseData(x, y) | |
45 { | |
46 if (x.id < y.id) | |
47 return -1; | |
48 else if (x.id === y.id) | |
49 return 0; | |
50 else | |
51 return 1; | |
52 } | |
53 | |
54 response.sort(comparePromiseData); | |
55 for (var i = 0; i < response.length; i++) { | |
56 var promise = response[i]; | |
57 var promiseInfo = "Promise:" + | |
58 "\n id: " + promise.id + | |
aandrey
2014/09/02 14:34:49
should be (promise.id - minPromiseId) to avoid tes
Alexandra Mikhaylova
2014/09/03 14:28:54
Done.
| |
59 "\n status: " + promise.status + | |
60 "\n parent id: " + promise.parentId; | |
aandrey
2014/09/02 14:34:49
ditto
Alexandra Mikhaylova
2014/09/03 14:28:54
Done.
| |
61 var callFrame = promise.callFrame; | |
62 if (callFrame) | |
63 promiseInfo = promiseInfo + | |
aandrey
2014/09/02 14:34:49
promiseInfo += ...
Alexandra Mikhaylova
2014/09/03 14:28:54
Done.
| |
64 "\n " + callFrame.functionName + " " + callFram e.url + ":" + callFrame.lineNumber; | |
65 output.push(promiseInfo); | |
66 } | |
67 | |
68 InspectorTest.addResults(output); | |
69 DebuggerAgent.disablePromiseTracker(); | |
70 InspectorTest.completeDebuggerTest(); | |
71 } | |
72 } | |
73 | |
74 </script> | |
75 </head> | |
76 | |
77 <body onload="runTest()"> | |
78 <p> | |
79 Tests promise tracker in debugger. | |
80 </p> | |
81 </body> | |
82 </html> | |
OLD | NEW |