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

Unified Diff: test/cctest/test-extra.js

Issue 2784213002: Add V8 extra utils for promise state (Closed)
Patch Set: Created 3 years, 9 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
« src/js/prologue.js ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-extra.js
diff --git a/test/cctest/test-extra.js b/test/cctest/test-extra.js
index 88c5f6e659d7b5e44946c6d2ca11cc0c3f6997fe..69a7e63221545de7e85a12ccc13fbe12b93748b0 100644
--- a/test/cctest/test-extra.js
+++ b/test/cctest/test-extra.js
@@ -70,12 +70,30 @@
v8.rejectPromise(rejectedButHandledPromise, 4);
v8.markPromiseAsHandled(rejectedButHandledPromise);
+ function promiseStateToString(promise) {
+ switch (v8.promiseState(promise)) {
+ case v8.kPROMISE_PENDING:
+ return "pending";
+ case v8.kPROMISE_FULFILLED:
+ return "fulfilled";
+ case v8.kPROMISE_REJECTED:
+ return "rejected";
+ default:
+ throw new Error("Unexpected value for promiseState");
+ }
+ }
+
+ let promiseStates = promiseStateToString(new Promise(() => {})) + ' ' +
+ promiseStateToString(fulfilledPromise) + ' ' +
+ promiseStateToString(rejectedPromise);
+
return {
privateSymbol: v8.createPrivateSymbol('sym'),
fulfilledPromise, // should be fulfilled with 1
fulfilledPromise2, // should be fulfilled with 2
rejectedPromise, // should be rejected with 3
- rejectedButHandledPromise // should be rejected but have a handler
+ rejectedButHandledPromise, // should be rejected but have a handler
+ promiseStates // should be the string "pending fulfilled rejected"
};
};
})
« src/js/prologue.js ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698