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

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

Issue 2954093003: [DevTools] Migrate inspector-protocol/runtime tests to new harness (Closed)
Patch Set: fail: Created 3 years, 5 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 (async function(testRunner) {
2 let {page, session, dp} = await testRunner.startBlank(`Tests that Runtime.eval uate works with awaitPromise flag.`);
3
4 function dumpResult(result) {
5 if (result.exceptionDetails) {
6 result.exceptionDetails.scriptId = '';
7 result.exceptionDetails.exceptionId = 0;
8 result.exceptionDetails.exception.objectId = 0;
9 }
10 testRunner.logObject(result);
11 }
12
13 await testRunner.runTestSuite([
14 async function testResolvedPromise() {
15 var result = await dp.Runtime.evaluate({ expression: 'Promise.resolve(239) ', awaitPromise: true, generatePreview: true });
16 dumpResult(result.result);
17 },
18
19 async function testRejectedPromise() {
20 var result = await dp.Runtime.evaluate({ expression: 'Promise.reject(239)' , awaitPromise: true });
21 dumpResult(result.result);
22 },
23
24 async function testPrimitiveValueInsteadOfPromise() {
25 var result = await dp.Runtime.evaluate({ expression: 'true', awaitPromise: true });
26 testRunner.logObject(result.error);
27 },
28
29 async function testObjectInsteadOfPromise() {
30 var result = await dp.Runtime.evaluate({ expression: '({})', awaitPromise: true });
31 testRunner.logObject(result.error);
32 },
33
34 async function testPendingPromise() {
35 var result = await dp.Runtime.evaluate({ expression: `
36 new Promise(resolve => setTimeout(() => resolve({ a : 239 }), 0))
37 `, awaitPromise: true, returnByValue: true });
38 dumpResult(result.result);
39 },
40
41 async function testExceptionInEvaluate() {
42 var result = await dp.Runtime.evaluate({ expression: 'throw 239', awaitPro mise: true });
43 dumpResult(result.result);
44 }
45 ]);
46 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698