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

Side by Side Diff: LayoutTests/inspector/sources/debugger/promise-tracker.html

Issue 529723002: [WIP] Protocol for sending information about Promises to frontend. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address comments Created 6 years, 3 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
« no previous file with comments | « no previous file | LayoutTests/inspector/sources/debugger/promise-tracker-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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) {
44
45 function comparePromiseData(x, y)
46 {
47 if (x.id < y.id)
48 return -1;
49 else if (x.id === y.id)
50 return 0;
51 else
52 return 1;
53 }
54
55 var minPromiseId;
56 if (response.length) {
57 minPromiseId = response[0].id;
58 for (var i = 0; i < response.length; i++) {
aandrey 2014/09/03 14:57:57 drop { and }
Alexandra Mikhaylova 2014/09/03 15:01:20 Done.
59 minPromiseId = Math.min(minPromiseId, response[i].id);
60 }
61 }
62 response.sort(comparePromiseData);
63 for (var i = 0; i < response.length; i++) {
64 var promise = response[i];
65 var parentId = promise.parentId ? promise.parentId - minPromiseId : undefined;
66 var promiseInfo = "Promise:" +
67 "\n id: " + (promise.id - minPromiseId) +
68 "\n status: " + promise.status +
69 "\n parent id: " + parentId;
70 var callFrame = promise.callFrame;
71 if (callFrame)
72 promiseInfo += "\n " + callFrame.functionName + " " + callFra me.url + ":" + callFrame.lineNumber;
73 output.push(promiseInfo);
74 }
75
76 InspectorTest.addResults(output);
77 DebuggerAgent.disablePromiseTracker();
78 InspectorTest.completeDebuggerTest();
79 }
80 }
81
82 </script>
83 </head>
84
85 <body onload="runTest()">
86 <p>
87 Tests promise tracker in debugger.
88 </p>
89 </body>
90 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/sources/debugger/promise-tracker-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698