Commit d298cced authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Cleanup] Avoid using deprecated v8::Function::Call in gin unittests.

Also replace deprecated uses of arraysize with base::size(array).

BUG=v8:7290,v8:8238

Change-Id: I1ea89bcc0162e8ac1f530be979511171d53c5467
Reviewed-on: https://chromium-review.googlesource.com/c/1349321
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: default avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610627}
parent e59066f4
...@@ -51,7 +51,8 @@ TEST_F(ArgumentsTest, TestArgumentsHolderCreationContext) { ...@@ -51,7 +51,8 @@ TEST_F(ArgumentsTest, TestArgumentsHolderCreationContext) {
ASSERT_TRUE(ConvertFromV8(isolate, script->Run(context).ToLocalChecked(), ASSERT_TRUE(ConvertFromV8(isolate, script->Run(context).ToLocalChecked(),
&function)); &function));
v8::Local<v8::Value> args[] = {object}; v8::Local<v8::Value> args[] = {object};
function->Call(v8::Undefined(isolate), arraysize(args), args); function->Call(context, v8::Undefined(isolate), base::size(args), args)
.ToLocalChecked();
}; };
// Test calling in the creation context. // Test calling in the creation context.
......
...@@ -157,7 +157,8 @@ class InterceptorTest : public V8Test { ...@@ -157,7 +157,8 @@ class InterceptorTest : public V8Test {
v8::Local<v8::Value> argv[] = { v8::Local<v8::Value> argv[] = {
ConvertToV8(isolate, obj.get()).ToLocalChecked(), ConvertToV8(isolate, obj.get()).ToLocalChecked(),
}; };
func->Call(v8::Undefined(isolate), 1, argv); func->Call(context_.Get(isolate), v8::Undefined(isolate), 1, argv)
.ToLocalChecked();
EXPECT_FALSE(try_catch.HasCaught()); EXPECT_FALSE(try_catch.HasCaught());
EXPECT_EQ("", try_catch.GetStackTrace()); EXPECT_EQ("", try_catch.GetStackTrace());
......
...@@ -167,7 +167,8 @@ TEST_F(WrappableTest, GetAndSetProperty) { ...@@ -167,7 +167,8 @@ TEST_F(WrappableTest, GetAndSetProperty) {
v8::Local<v8::Value> argv[] = { v8::Local<v8::Value> argv[] = {
ConvertToV8(isolate, obj.get()).ToLocalChecked(), ConvertToV8(isolate, obj.get()).ToLocalChecked(),
}; };
func->Call(v8::Undefined(isolate), 1, argv); func->Call(context_.Get(isolate), v8::Undefined(isolate), 1, argv)
.ToLocalChecked();
EXPECT_FALSE(try_catch.HasCaught()); EXPECT_FALSE(try_catch.HasCaught());
EXPECT_EQ("", try_catch.GetStackTrace()); EXPECT_EQ("", try_catch.GetStackTrace());
...@@ -206,7 +207,8 @@ TEST_F(WrappableTest, MethodInvocationErrorsOnUnnamedObject) { ...@@ -206,7 +207,8 @@ TEST_F(WrappableTest, MethodInvocationErrorsOnUnnamedObject) {
v8::Local<v8::Function> func; v8::Local<v8::Function> func;
EXPECT_TRUE(ConvertFromV8(isolate, val, &func)); EXPECT_TRUE(ConvertFromV8(isolate, val, &func));
v8::Local<v8::Value> argv[] = {function_to_run, context_object}; v8::Local<v8::Value> argv[] = {function_to_run, context_object};
func->Call(v8::Undefined(isolate), arraysize(argv), argv); func->Call(context, v8::Undefined(isolate), base::size(argv), argv)
.FromMaybe(v8::Local<v8::Value>());
if (!try_catch.HasCaught()) if (!try_catch.HasCaught())
return std::string(); return std::string();
return V8ToString(isolate, try_catch.Message()->Get()); return V8ToString(isolate, try_catch.Message()->Get());
...@@ -261,7 +263,8 @@ TEST_F(WrappableTest, MethodInvocationErrorsOnNamedObject) { ...@@ -261,7 +263,8 @@ TEST_F(WrappableTest, MethodInvocationErrorsOnNamedObject) {
v8::Local<v8::Function> func; v8::Local<v8::Function> func;
EXPECT_TRUE(ConvertFromV8(isolate, val, &func)); EXPECT_TRUE(ConvertFromV8(isolate, val, &func));
v8::Local<v8::Value> argv[] = {function_to_run, context_object}; v8::Local<v8::Value> argv[] = {function_to_run, context_object};
func->Call(v8::Undefined(isolate), arraysize(argv), argv); func->Call(context, v8::Undefined(isolate), base::size(argv), argv)
.FromMaybe(v8::Local<v8::Value>());
if (!try_catch.HasCaught()) if (!try_catch.HasCaught())
return std::string(); return std::string();
return V8ToString(isolate, try_catch.Message()->Get()); return V8ToString(isolate, try_catch.Message()->Get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment