| Index: test/inspector/runtime/evaluate-async.js
|
| diff --git a/test/inspector/runtime/evaluate-async.js b/test/inspector/runtime/evaluate-async.js
|
| index a6cd1c3379e96511f07b29b3226fc8fe2028278c..cc94ade18a8c3a0ce1b21514b5fefa93eddef7c2 100644
|
| --- a/test/inspector/runtime/evaluate-async.js
|
| +++ b/test/inspector/runtime/evaluate-async.js
|
| @@ -4,7 +4,7 @@
|
|
|
| print("Tests that Runtime.evaluate works with awaitPromise flag.");
|
|
|
| -InspectorTest.evaluateInPage(`
|
| +InspectorTest.addScript(`
|
| function createPromiseAndScheduleResolve()
|
| {
|
| var resolveCallback;
|
| @@ -13,56 +13,46 @@ function createPromiseAndScheduleResolve()
|
| return promise;
|
| }`);
|
|
|
| -function dumpResult(result)
|
| -{
|
| - if (result.exceptionDetails) {
|
| - result.exceptionDetails.scriptId = "(scriptId)";
|
| - result.exceptionDetails.exceptionId = 0;
|
| - result.exceptionDetails.exception.objectId = 0;
|
| - }
|
| - InspectorTest.logObject(result);
|
| -}
|
| -
|
| InspectorTest.runTestSuite([
|
| function testResolvedPromise(next)
|
| {
|
| - InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "Promise.resolve(239)", awaitPromise: true, generatePreview: true })
|
| - .then((result) => dumpResult(result.result))
|
| - .then(() => next());
|
| + Protocol.Runtime.evaluate({ expression: "Promise.resolve(239)", awaitPromise: true, generatePreview: true })
|
| + .then(result => InspectorTest.logMessage(result))
|
| + .then(_ => next());
|
| },
|
|
|
| function testRejectedPromise(next)
|
| {
|
| - InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "Promise.reject(239)", awaitPromise: true })
|
| - .then((result) => dumpResult(result.result))
|
| - .then(() => next());
|
| + Protocol.Runtime.evaluate({ expression: "Promise.reject(239)", awaitPromise: true })
|
| + .then(result => InspectorTest.logMessage(result))
|
| + .then(_ => next());
|
| },
|
|
|
| function testPrimitiveValueInsteadOfPromise(next)
|
| {
|
| - InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "true", awaitPromise: true })
|
| - .then((result) => InspectorTest.logObject(result.error))
|
| - .then(() => next());
|
| + Protocol.Runtime.evaluate({ expression: "true", awaitPromise: true })
|
| + .then(result => InspectorTest.logMessage(result))
|
| + .then(_ => next());
|
| },
|
|
|
| function testObjectInsteadOfPromise(next)
|
| {
|
| - InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "({})", awaitPromise: true })
|
| - .then((result) => InspectorTest.logObject(result.error))
|
| - .then(() => next());
|
| + Protocol.Runtime.evaluate({ expression: "({})", awaitPromise: true })
|
| + .then(result => InspectorTest.logMessage(result))
|
| + .then(_ => next());
|
| },
|
|
|
| function testPendingPromise(next)
|
| {
|
| - InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "createPromiseAndScheduleResolve()", awaitPromise: true, returnByValue: true })
|
| - .then((result) => dumpResult(result.result))
|
| - .then(() => next());
|
| + Protocol.Runtime.evaluate({ expression: "createPromiseAndScheduleResolve()", awaitPromise: true, returnByValue: true })
|
| + .then(result => InspectorTest.logMessage(result))
|
| + .then(_ => next());
|
| },
|
|
|
| function testExceptionInEvaluate(next)
|
| {
|
| - InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "throw 239", awaitPromise: true })
|
| - .then((result) => dumpResult(result.result))
|
| - .then(() => next());
|
| + Protocol.Runtime.evaluate({ expression: "throw 239", awaitPromise: true })
|
| + .then(result => InspectorTest.logMessage(result))
|
| + .then(_ => next());
|
| }
|
| ]);
|
|
|