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

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

Issue 1827993002: [DevTools] Remove promise inspector experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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
(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 var promise;
8 function testFunction()
9 {
10 promise = new Promise(function promiseConstructor(resolve, reject) {
11 resolve("Resolved!");
12 });
13 promise
14 .then(thenCallback, errorCallback)
15 .then(thenCallback2, errorCallback);
16 }
17
18 function thenCallback() { }
19
20 function thenCallback2()
21 {
22 debugger;
23 }
24
25 function errorCallback() { }
26
27 var test = function ()
28 {
29 InspectorTest.startDebuggerTest(step1);
30
31 var minPromiseId;
32 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.PromiseUpdated, onPromiseUpdated, this);
33 function onPromiseUpdated(event)
34 {
35 var target = /** @type {!WebInspector.Target} */ (event.target.target()) ;
36 var eventType = /** @type {string} */ (event.data.eventType);
37 var promise = /** @type {!DebuggerAgent.PromiseDetails} */ (event.data.p romise);
38
39 if (typeof minPromiseId === "undefined")
40 minPromiseId = promise.id;
41
42 var parentId = promise.parentId ? promise.parentId - minPromiseId : unde fined;
43 var promiseInfo = [];
44 promiseInfo.push("Promise (" + eventType + "):");
45 if (eventType !== "gc") {
46 promiseInfo.push("id: " + (promise.id - minPromiseId));
47 promiseInfo.push("status: " + promise.status);
48 if (parentId)
49 promiseInfo.push("parent id: " + parentId);
50 var callFrame = promise.creationStack ? promise.creationStack.callFr ames[0] : null;
51 if (callFrame) {
52 var url = WebInspector.displayNameForURL(callFrame.url);
53 promiseInfo.push(callFrame.functionName + " " + url + ":" + call Frame.lineNumber);
54 }
55 if (promise.creationTime)
56 promiseInfo.push("creationTime: " + (promise.creationTime > 0));
57 if (promise.settlementTime)
58 promiseInfo.push("settlementTime: " + (promise.settlementTime > 0));
59 }
60 InspectorTest.addResult(promiseInfo.join("\n "));
61 }
62
63 function step1()
64 {
65 InspectorTest.DebuggerAgent.enablePromiseTracker();
66 InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
67 }
68
69 function step2()
70 {
71 InspectorTest.DebuggerAgent.getPromiseById(minPromiseId, "console", didG etPromiseById);
72 }
73
74 function didGetPromiseById(error, response)
75 {
76 if (error) {
77 InspectorTest.addResult("Failed to get promise by id: " + error);
78 InspectorTest.DebuggerAgent.disablePromiseTracker();
79 InspectorTest.completeDebuggerTest();
80 return;
81 }
82 InspectorTest.addResult("Got promise by id: " + !error);
83 InspectorTest.addResult("Resolved object class: " + response.className);
84 InspectorTest.RuntimeAgent.getProperties(response.objectId, didGetProper ties);
85 }
86
87 function didGetProperties(error, properties, internalProperties)
88 {
89 InspectorTest.assertTrue("Received internal properties of the first prom ise: " + (internalProperties && internalProperties.length > 0));
90
91 var status, value;
92 for (var i = 0; i < internalProperties.length; i++) {
93 var property = internalProperties[i];
94 if (property.name === "[[PromiseStatus]]")
95 status = property.value.value;
96 if (property.name === "[[PromiseValue]]")
97 value = property.value.value;
98 }
99
100 InspectorTest.addResult("Promise:\n status: " + status + "\n value : " + value);
101
102 InspectorTest.DebuggerAgent.disablePromiseTracker();
103 InspectorTest.completeDebuggerTest();
104 }
105 }
106
107 </script>
108 </head>
109
110 <body onload="runTest()">
111 <p>
112 Tests promise tracker in debugger.
113 </p>
114 </body>
115 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698