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

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

Issue 2428463002: [serializer] add test case for unknown external references. (Closed)
Patch Set: fix 2 Created 4 years, 2 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 | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 5e0b7b3c7af377f928a4ff1c1871ddf357bfe75c..1ac37fb6d3b870af7eb0f696ee8a9fe047f125c0 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -2010,12 +2010,11 @@ TEST(SnapshotCreatorMultipleContexts) {
delete[] blob.data;
}
-static void SerializedCallback(
- const v8::FunctionCallbackInfo<v8::Value>& args) {
+void SerializedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8_num(42));
}
-static void SerializedCallbackReplacement(
+void SerializedCallbackReplacement(
const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8_num(1337));
}
@@ -2086,6 +2085,30 @@ TEST(SnapshotCreatorExternalReferences) {
delete[] blob.data;
}
+TEST(SnapshotCreatorUnknownExternalReferences) {
+ DisableTurbofan();
+ v8::SnapshotCreator creator;
+ v8::Isolate* isolate = creator.GetIsolate();
+ {
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+
+ v8::Local<v8::FunctionTemplate> callback =
+ v8::FunctionTemplate::New(isolate, SerializedCallback);
+ v8::Local<v8::Value> function =
+ callback->GetFunction(context).ToLocalChecked();
+ CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust());
+ ExpectInt32("f()", 42);
+
+ CHECK_EQ(0, creator.AddContext(context));
+ }
+ v8::StartupData blob =
+ creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
+
+ delete[] blob.data;
+}
+
TEST(SnapshotCreatorTemplates) {
DisableTurbofan();
v8::StartupData blob;
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698