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

Unified Diff: test/cctest/test-api-fast-accessor-builder.cc

Issue 2160563003: Reinforce fast-accessor-assembler tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api-fast-accessor-builder.cc
diff --git a/test/cctest/test-api-fast-accessor-builder.cc b/test/cctest/test-api-fast-accessor-builder.cc
index ce22d9a59c160f01a62952e5ea69f8778d9ce8f9..134213204a37a39e14cc86bf75493394dedd24d5 100644
--- a/test/cctest/test-api-fast-accessor-builder.cc
+++ b/test/cctest/test-api-fast-accessor-builder.cc
@@ -62,6 +62,18 @@ static void NativePropertyAccessor(
} // anonymous namespace
+void CheckImplicitParameters(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ v8::Isolate* isolate = info.GetIsolate();
+ CHECK_NOT_NULL(isolate);
+
+ auto context = isolate->GetCurrentContext();
+ CHECK(!context.IsEmpty());
+
+ // The context must point to the same isolate, this should be enough to
+ // validate the context, mainly to prevent having a random object instead.
+ CHECK_EQ(isolate, context->GetIsolate());
+ CHECK(info.Data()->IsUndefined());
vogelheim 2016/07/19 12:46:10 Maybe we can check info.Holder()? This should be
+}
// Build a simple "fast accessor" and verify that it is being called.
TEST(FastAccessor) {
@@ -300,16 +312,19 @@ TEST(FastAccessorLoad) {
}
void ApiCallbackInt(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ CheckImplicitParameters(info);
info.GetReturnValue().Set(12345);
}
const char* kApiCallbackStringValue =
"Hello World! Bizarro C++ world, actually.";
void ApiCallbackString(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ CheckImplicitParameters(info);
info.GetReturnValue().Set(v8_str(kApiCallbackStringValue));
}
void ApiCallbackParam(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ CheckImplicitParameters(info);
CHECK_EQ(1, info.Length());
CHECK(info[0]->IsNumber());
info.GetReturnValue().Set(info[0]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698