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

Unified Diff: test/cctest/test-api.cc

Issue 2633443002: [promisehook] Pass deferred promise to Before/After callback (Closed)
Patch Set: Remove adaptor Created 3 years, 11 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:
Download patch
« no previous file with comments | « src/runtime/runtime-promise.cc ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 927f74c135ba0afe1504c20877dd66ae2d3fdaf9..cec1e653fcb7300bcc97008957aeeb84dedfab55 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -18262,11 +18262,24 @@ TEST(PromiseHook) {
global->Get(context, v8_str("resolve")).ToLocalChecked();
auto before_promise = global->Get(context, v8_str("before")).ToLocalChecked();
auto after_promise = global->Get(context, v8_str("after")).ToLocalChecked();
- CHECK(GetPromise("p")->Equals(env.local(), before_promise).FromJust());
- CHECK(GetPromise("p")->Equals(env.local(), after_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), before_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), after_promise).FromJust());
CHECK(GetPromise("p1")->Equals(env.local(), resolve_promise).FromJust());
CHECK_EQ(6, promise_hook_data->promise_hook_count);
+ CompileRun("value = ''; var p2 = p1.then(() => { value = 'fulfilled' }); \n");
+ init_promise = global->Get(context, v8_str("init")).ToLocalChecked();
+ parent_promise = global->Get(context, v8_str("parent")).ToLocalChecked();
+ resolve_promise = global->Get(context, v8_str("resolve")).ToLocalChecked();
+ before_promise = global->Get(context, v8_str("before")).ToLocalChecked();
+ after_promise = global->Get(context, v8_str("after")).ToLocalChecked();
+ CHECK(GetPromise("p2")->Equals(env.local(), init_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), parent_promise).FromJust());
+ CHECK(GetPromise("p2")->Equals(env.local(), before_promise).FromJust());
+ CHECK(GetPromise("p2")->Equals(env.local(), after_promise).FromJust());
+ CHECK(GetPromise("p2")->Equals(env.local(), resolve_promise).FromJust());
+ CHECK_EQ(10, promise_hook_data->promise_hook_count);
+
promise_hook_data->Reset();
promise_hook_data->promise_hook_value = "rejected";
source =
@@ -18291,8 +18304,8 @@ TEST(PromiseHook) {
resolve_promise = global->Get(context, v8_str("resolve")).ToLocalChecked();
before_promise = global->Get(context, v8_str("before")).ToLocalChecked();
after_promise = global->Get(context, v8_str("after")).ToLocalChecked();
- CHECK(GetPromise("p")->Equals(env.local(), before_promise).FromJust());
- CHECK(GetPromise("p")->Equals(env.local(), after_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), before_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), after_promise).FromJust());
CHECK(GetPromise("p1")->Equals(env.local(), resolve_promise).FromJust());
CHECK_EQ(6, promise_hook_data->promise_hook_count);
@@ -18320,8 +18333,8 @@ TEST(PromiseHook) {
CHECK(GetPromise("p1")->Equals(env.local(), init_promise).FromJust());
CHECK(GetPromise("p1")->Equals(env.local(), resolve_promise).FromJust());
CHECK(GetPromise("p")->Equals(env.local(), parent_promise).FromJust());
- CHECK(GetPromise("p")->Equals(env.local(), before_promise).FromJust());
- CHECK(GetPromise("p")->Equals(env.local(), after_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), before_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), after_promise).FromJust());
CHECK_EQ(6, promise_hook_data->promise_hook_count);
CHECK_EQ(1, promise_hook_data->parent_promise_count);
@@ -18460,8 +18473,8 @@ TEST(PromiseHook) {
resolve_promise = global->Get(context, v8_str("resolve")).ToLocalChecked();
before_promise = global->Get(context, v8_str("before")).ToLocalChecked();
after_promise = global->Get(context, v8_str("after")).ToLocalChecked();
- CHECK(GetPromise("p")->Equals(env.local(), before_promise).FromJust());
- CHECK(GetPromise("p")->Equals(env.local(), after_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), before_promise).FromJust());
+ CHECK(GetPromise("p1")->Equals(env.local(), after_promise).FromJust());
CHECK(GetPromise("p1")->Equals(env.local(), resolve_promise).FromJust());
// 3) resolve hook (p)
// 4) before hook (p)
« no previous file with comments | « src/runtime/runtime-promise.cc ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698