| Index: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.html b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b970f56d85f8b63fcd519e8c7395a7385342388c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.html
|
| @@ -0,0 +1,72 @@
|
| +<html>
|
| +<head>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script>
|
| +
|
| +function createPromiseAndScheduleResolve()
|
| +{
|
| + var resolveCallback;
|
| + var promise = new Promise((resolve) => resolveCallback = resolve);
|
| + setTimeout(resolveCallback.bind(null, { a : 239 }), 0);
|
| + return promise;
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + InspectorTest.runTestSuite([
|
| + function testResolvedPromise(next)
|
| + {
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "Promise.resolve(239)", awaitPromise: true, generatePreview: true })
|
| + .then((result) => InspectorTest.logObject(result.result))
|
| + .then(() => next());
|
| + },
|
| +
|
| + function testRejectedPromise(next)
|
| + {
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "Promise.reject(239)", awaitPromise: true })
|
| + .then((result) => InspectorTest.logObject(result.result))
|
| + .then(() => next());
|
| + },
|
| +
|
| + function testPrimitiveValueInsteadOfPromise(next)
|
| + {
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "true", awaitPromise: true })
|
| + .then((result) => InspectorTest.logObject(result.error))
|
| + .then(() => next());
|
| + },
|
| +
|
| + function testObjectInsteadOfPromise(next)
|
| + {
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "({})", awaitPromise: true })
|
| + .then((result) => InspectorTest.logObject(result.error))
|
| + .then(() => next());
|
| + },
|
| +
|
| + function testPendingPromise(next)
|
| + {
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "createPromiseAndScheduleResolve()", awaitPromise: true, returnByValue: true })
|
| + .then((result) => InspectorTest.logObject(result.result))
|
| + .then(() => next());
|
| + },
|
| +
|
| + function testExceptionInEvaluate(next)
|
| + {
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "throw 239", awaitPromise: true })
|
| + .then((result) => dumpResult(result.result))
|
| + .then(() => next());
|
| +
|
| + function dumpResult(result)
|
| + {
|
| + result.exceptionDetails.scriptId = "";
|
| + InspectorTest.logObject(result);
|
| + }
|
| + }
|
| + ]);
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onLoad="runTest();">
|
| +Tests that Runtime.evaluate works with awaitPromise flag.
|
| +</body>
|
| +</html>
|
| +
|
|
|