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

Unified 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, 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
+
« 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