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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.html

Issue 2196003002: [DevTools] Add awaitPromise flag to Runtime.evaluate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-promise-then
Patch Set: addressed comments Created 4 years, 4 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 | third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async-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 type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script>
5
6 function createPromiseAndScheduleResolve()
7 {
8 var resolveCallback;
9 var promise = new Promise((resolve) => resolveCallback = resolve);
10 setTimeout(resolveCallback.bind(null, { a : 239 }), 0);
11 return promise;
12 }
13
14 function test()
15 {
16 InspectorTest.runTestSuite([
17 function testResolvedPromise(next)
18 {
19 InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: " Promise.resolve(239)", awaitPromise: true, generatePreview: true })
20 .then((result) => InspectorTest.logObject(result.result))
21 .then(() => next());
22 },
23
24 function testRejectedPromise(next)
25 {
26 InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: " Promise.reject(239)", awaitPromise: true })
27 .then((result) => InspectorTest.logObject(result.result))
28 .then(() => next());
29 },
30
31 function testPrimitiveValueInsteadOfPromise(next)
32 {
33 InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: " true", awaitPromise: true })
34 .then((result) => InspectorTest.logObject(result.error))
35 .then(() => next());
36 },
37
38 function testObjectInsteadOfPromise(next)
39 {
40 InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: " ({})", awaitPromise: true })
41 .then((result) => InspectorTest.logObject(result.error))
42 .then(() => next());
43 },
44
45 function testPendingPromise(next)
46 {
47 InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: " createPromiseAndScheduleResolve()", awaitPromise: true, returnByValue: true })
48 .then((result) => InspectorTest.logObject(result.result))
49 .then(() => next());
50 },
51
52 function testExceptionInEvaluate(next)
53 {
54 InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: " throw 239", awaitPromise: true })
55 .then((result) => dumpResult(result.result))
56 .then(() => next());
57
58 function dumpResult(result)
59 {
60 result.exceptionDetails.scriptId = "";
61 InspectorTest.logObject(result);
62 }
63 }
64 ]);
65 }
66 </script>
67 </head>
68 <body onLoad="runTest();">
69 Tests that Runtime.evaluate works with awaitPromise flag.
70 </body>
71 </html>
72
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698