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

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 + REBASE 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++)
59 minPromiseId = Math.min(minPromiseId, response[i].id);
60 }
61 response.sort(comparePromiseData);
62 for (var i = 0; i < response.length; i++) {
63 var promise = response[i];
64 var parentId = promise.parentId ? promise.parentId - minPromiseId : undefined;
65 var promiseInfo = "Promise:" +
66 "\n id: " + (promise.id - minPromiseId) +
67 "\n status: " + promise.status +
68 "\n parent id: " + parentId;
69 var callFrame = promise.callFrame;
70 if (callFrame)
71 promiseInfo += "\n " + callFrame.functionName + " " + callFra me.url + ":" + callFrame.lineNumber;
72 output.push(promiseInfo);
73 }
74
75 InspectorTest.addResults(output);
76 DebuggerAgent.disablePromiseTracker();
77 InspectorTest.completeDebuggerTest();
78 }
79 }
80
81 </script>
82 </head>
83
84 <body onload="runTest()">
85 <p>
86 Tests promise tracker in debugger.
87 </p>
88 </body>
89 </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