Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index dad5d6caf5ca1e79d4e2924b998ce52b818c89c3..da615597f66637fba701c9bea6904694766e8f6c 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -21616,14 +21616,14 @@ TEST(StrongObjectDelete) { |
} |
-static void ExtrasExportsTestRuntimeFunction( |
+static void ExtrasBindingTestRuntimeFunction( |
const v8::FunctionCallbackInfo<v8::Value>& args) { |
CHECK_EQ(3, args[0]->Int32Value()); |
args.GetReturnValue().Set(v8_num(7)); |
} |
-TEST(ExtrasExportsObject) { |
+TEST(ExtrasBindingObject) { |
v8::Isolate* isolate = CcTest::isolate(); |
v8::HandleScope handle_scope(isolate); |
LocalContext env; |
@@ -21639,7 +21639,7 @@ TEST(ExtrasExportsObject) { |
CHECK_EQ(5, result->Int32Value()); |
v8::Handle<v8::FunctionTemplate> runtimeFunction = |
- v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction); |
+ v8::FunctionTemplate::New(isolate, ExtrasBindingTestRuntimeFunction); |
binding->Set(v8_str("runtime"), runtimeFunction->GetFunction()); |
func = |
binding->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>(); |
@@ -21648,6 +21648,33 @@ TEST(ExtrasExportsObject) { |
} |
+TEST(ExperimentalExtras) { |
+ i::FLAG_experimental_extras = true; |
+ |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope handle_scope(isolate); |
+ LocalContext env; |
+ |
+ // standalone.gypi ensures we include the test-experimental-extra.js file, |
+ // which should export the tested functions. |
+ v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); |
+ |
+ auto func = binding->Get(v8_str("testExperimentalExtraShouldReturnTen")) |
+ .As<v8::Function>(); |
+ auto undefined = v8::Undefined(isolate); |
+ auto result = func->Call(undefined, 0, {}).As<v8::Number>(); |
+ CHECK_EQ(10, result->Int32Value()); |
+ |
+ v8::Handle<v8::FunctionTemplate> runtimeFunction = |
+ v8::FunctionTemplate::New(isolate, ExtrasBindingTestRuntimeFunction); |
+ binding->Set(v8_str("runtime"), runtimeFunction->GetFunction()); |
+ func = binding->Get(v8_str("testExperimentalExtraShouldCallToRuntime")) |
+ .As<v8::Function>(); |
+ result = func->Call(undefined, 0, {}).As<v8::Number>(); |
+ CHECK_EQ(7, result->Int32Value()); |
+} |
+ |
+ |
TEST(Map) { |
v8::Isolate* isolate = CcTest::isolate(); |
v8::HandleScope handle_scope(isolate); |