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

Unified 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, 6 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
Index: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.js b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.js
new file mode 100644
index 0000000000000000000000000000000000000000..3df947751b0186d277d863c846e47508289f7713
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-evaluate-async.js
@@ -0,0 +1,46 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank(`Tests that Runtime.evaluate works with awaitPromise flag.`);
+
+ function dumpResult(result) {
+ if (result.exceptionDetails) {
+ result.exceptionDetails.scriptId = '';
+ result.exceptionDetails.exceptionId = 0;
+ result.exceptionDetails.exception.objectId = 0;
+ }
+ testRunner.logObject(result);
+ }
+
+ await testRunner.runTestSuite([
+ async function testResolvedPromise() {
+ var result = await dp.Runtime.evaluate({ expression: 'Promise.resolve(239)', awaitPromise: true, generatePreview: true });
+ dumpResult(result.result);
+ },
+
+ async function testRejectedPromise() {
+ var result = await dp.Runtime.evaluate({ expression: 'Promise.reject(239)', awaitPromise: true });
+ dumpResult(result.result);
+ },
+
+ async function testPrimitiveValueInsteadOfPromise() {
+ var result = await dp.Runtime.evaluate({ expression: 'true', awaitPromise: true });
+ testRunner.logObject(result.error);
+ },
+
+ async function testObjectInsteadOfPromise() {
+ var result = await dp.Runtime.evaluate({ expression: '({})', awaitPromise: true });
+ testRunner.logObject(result.error);
+ },
+
+ async function testPendingPromise() {
+ var result = await dp.Runtime.evaluate({ expression: `
+ new Promise(resolve => setTimeout(() => resolve({ a : 239 }), 0))
+ `, awaitPromise: true, returnByValue: true });
+ dumpResult(result.result);
+ },
+
+ async function testExceptionInEvaluate() {
+ var result = await dp.Runtime.evaluate({ expression: 'throw 239', awaitPromise: true });
+ dumpResult(result.result);
+ }
+ ]);
+})

Powered by Google App Engine
This is Rietveld 408576698