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

Unified Diff: test/inspector/runtime/evaluate-async.js

Issue 2369753004: [inspector] added inspector test runner [part 5] (Closed)
Patch Set: addressed comments Created 4 years, 3 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: test/inspector/runtime/evaluate-async.js
diff --git a/test/inspector/runtime/evaluate-async.js b/test/inspector/runtime/evaluate-async.js
new file mode 100644
index 0000000000000000000000000000000000000000..a6cd1c3379e96511f07b29b3226fc8fe2028278c
--- /dev/null
+++ b/test/inspector/runtime/evaluate-async.js
@@ -0,0 +1,68 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+print("Tests that Runtime.evaluate works with awaitPromise flag.");
+
+InspectorTest.evaluateInPage(`
+function createPromiseAndScheduleResolve()
+{
+ var resolveCallback;
+ var promise = new Promise((resolve) => resolveCallback = resolve);
+ setTimeout(resolveCallback.bind(null, { a : 239 }), 0);
+ 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());
+ },
+
+ function testRejectedPromise(next)
+ {
+ InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "Promise.reject(239)", awaitPromise: true })
+ .then((result) => dumpResult(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) => dumpResult(result.result))
+ .then(() => next());
+ },
+
+ function testExceptionInEvaluate(next)
+ {
+ InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "throw 239", awaitPromise: true })
+ .then((result) => dumpResult(result.result))
+ .then(() => next());
+ }
+]);
« no previous file with comments | « test/inspector/runtime/console-timestamp-expected.txt ('k') | test/inspector/runtime/evaluate-async-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698