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

Unified Diff: test/cctest/test-code-stub-assembler.cc

Issue 2566483002: [promisehook] Add is_promisehook_enabled (Closed)
Patch Set: rename var Created 4 years 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 | « src/isolate.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-code-stub-assembler.cc
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
index 6635d6b919825b8781361d901a505d1f98c16672..b4b9e7b55b2ea5b41c177ec11838869b10bfb89a 100644
--- a/test/cctest/test-code-stub-assembler.cc
+++ b/test/cctest/test-code-stub-assembler.cc
@@ -1972,5 +1972,32 @@ TEST(CodeStubAssemblerGraphsCorrectness) {
v8_isolate->Dispose();
}
+TEST(IsPromiseHookEnabled) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+
+ const int kNumParams = 1;
+ CodeAssemblerTester data(isolate, kNumParams);
+ CodeStubAssembler m(data.state());
+
+ m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabled()));
+
+ Handle<Code> code = data.GenerateCode();
+ CHECK(!code.is_null());
+
+ FunctionTester ft(code, kNumParams);
+ CHECK_EQ(false, isolate->IsPromiseHookEnabled());
+ Handle<Object> result =
+ ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->false_value(), *result);
+
+ isolate->EnablePromiseHook();
+ result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->true_value(), *result);
+
+ isolate->DisablePromiseHook();
+ result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->false_value(), *result);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698