diff --git a/test/cctest/node_test_fixture.cc b/test/cctest/node_test_fixture.cc index 3e5a112240f6d3..acc975a4cb3c6e 100644 --- a/test/cctest/node_test_fixture.cc +++ b/test/cctest/node_test_fixture.cc @@ -1,7 +1,6 @@ #include "node_test_fixture.h" +ArrayBufferUniquePtr NodeTestFixture::allocator{nullptr, nullptr}; uv_loop_t NodeTestFixture::current_loop; -std::unique_ptr NodeTestFixture::platform; -std::unique_ptr NodeTestFixture::allocator; -std::unique_ptr NodeTestFixture::tracing_controller; -v8::Isolate::CreateParams NodeTestFixture::params; +NodePlatformUniquePtr NodeTestFixture::platform; +TracingControllerUniquePtr NodeTestFixture::tracing_controller; diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index f43cb56cd3a5b5..8cba5d99ba3c64 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -53,13 +53,16 @@ struct Argv { int nr_args_; }; +using ArrayBufferUniquePtr = std::unique_ptr; +using TracingControllerUniquePtr = std::unique_ptr; +using NodePlatformUniquePtr = std::unique_ptr; class NodeTestFixture : public ::testing::Test { protected: - static std::unique_ptr allocator; - static std::unique_ptr tracing_controller; - static std::unique_ptr platform; - static v8::Isolate::CreateParams params; + static ArrayBufferUniquePtr allocator; + static TracingControllerUniquePtr tracing_controller; + static NodePlatformUniquePtr platform; static uv_loop_t current_loop; v8::Isolate* isolate_; @@ -68,8 +71,6 @@ class NodeTestFixture : public ::testing::Test { node::tracing::TraceEventHelper::SetTracingController( tracing_controller.get()); platform.reset(new node::NodePlatform(4, nullptr)); - allocator.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator()); - params.array_buffer_allocator = allocator.get(); CHECK_EQ(0, uv_loop_init(¤t_loop)); v8::V8::InitializePlatform(platform.get()); v8::V8::Initialize(); @@ -85,7 +86,9 @@ class NodeTestFixture : public ::testing::Test { } virtual void SetUp() { - isolate_ = v8::Isolate::New(params); + allocator = ArrayBufferUniquePtr(node::CreateArrayBufferAllocator(), + &node::FreeArrayBufferAllocator); + isolate_ = NewIsolate(allocator.get()); CHECK_NE(isolate_, nullptr); }