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

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

Issue 2406973003: Revert of [modules] Store Module metadata in per-Context EmbedderData (Closed)
Patch Set: 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 | « src/objects-printer.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-modules.cc
diff --git a/test/cctest/test-modules.cc b/test/cctest/test-modules.cc
index e086a407f9e669bf9dabef6ddc8396aef1349524..c33a5a124b94e817e3c9ab816bb0b5934e2fd465 100644
--- a/test/cctest/test-modules.cc
+++ b/test/cctest/test-modules.cc
@@ -21,14 +21,16 @@
MaybeLocal<Module> AlwaysEmptyResolveCallback(Local<Context> context,
Local<String> specifier,
- Local<Module> referrer) {
+ Local<Module> referrer,
+ Local<Value> data) {
return MaybeLocal<Module>();
}
static int g_count = 0;
MaybeLocal<Module> FailOnSecondCallResolveCallback(Local<Context> context,
Local<String> specifier,
- Local<Module> referrer) {
+ Local<Module> referrer,
+ Local<Value> data) {
if (g_count++ > 0) return MaybeLocal<Module>();
Local<String> source_text = v8_str("");
ScriptOrigin origin(v8_str("module.js"));
@@ -65,7 +67,8 @@
}
static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback(
- Local<Context> context, Local<String> specifier, Local<Module> referrer) {
+ Local<Context> context, Local<String> specifier, Local<Module> referrer,
+ Local<Value> data) {
ScriptOrigin origin(v8_str("module.js"));
ScriptCompiler::Source source(specifier, origin);
return ScriptCompiler::CompileModule(CcTest::isolate(), &source)
@@ -90,4 +93,19 @@
ExpectInt32("Object.expando", 10);
}
+TEST(EmbedderData) {
+ Isolate* isolate = CcTest::isolate();
+ HandleScope scope(isolate);
+ LocalContext env;
+
+ Local<String> source_text = v8_str("");
+ ScriptOrigin origin(v8_str("file.js"));
+ ScriptCompiler::Source source(source_text, origin);
+ Local<Module> module =
+ ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked();
+ CHECK(module->GetEmbedderData()->IsUndefined());
+ module->SetEmbedderData(v8_num(42));
+ CHECK_EQ(42, Local<v8::Int32>::Cast(module->GetEmbedderData())->Value());
+}
+
} // anonymous namespace
« no previous file with comments | « src/objects-printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698