diff options
Diffstat (limited to 'deps/v8/test/unittests/test-utils.cc')
-rw-r--r-- | deps/v8/test/unittests/test-utils.cc | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/deps/v8/test/unittests/test-utils.cc b/deps/v8/test/unittests/test-utils.cc index 2b099e0ea5..32f405764d 100644 --- a/deps/v8/test/unittests/test-utils.cc +++ b/deps/v8/test/unittests/test-utils.cc @@ -24,32 +24,28 @@ Isolate* TestWithIsolate::isolate_ = nullptr; TestWithIsolate::TestWithIsolate() : isolate_scope_(isolate()), handle_scope_(isolate()) {} - -TestWithIsolate::~TestWithIsolate() {} - +TestWithIsolate::~TestWithIsolate() = default; // static void TestWithIsolate::SetUpTestCase() { Test::SetUpTestCase(); - EXPECT_EQ(NULL, isolate_); - // Make BigInt64Array / BigUint64Array available for testing. - i::FLAG_harmony_bigint = true; + EXPECT_EQ(nullptr, isolate_); v8::Isolate::CreateParams create_params; array_buffer_allocator_ = v8::ArrayBuffer::Allocator::NewDefaultAllocator(); create_params.array_buffer_allocator = array_buffer_allocator_; isolate_ = v8::Isolate::New(create_params); - EXPECT_TRUE(isolate_ != NULL); + EXPECT_TRUE(isolate_ != nullptr); } // static void TestWithIsolate::TearDownTestCase() { - ASSERT_TRUE(isolate_ != NULL); + ASSERT_TRUE(isolate_ != nullptr); v8::Platform* platform = internal::V8::GetCurrentPlatform(); - ASSERT_TRUE(platform != NULL); + ASSERT_TRUE(platform != nullptr); while (platform::PumpMessageLoop(platform, isolate_)) continue; isolate_->Dispose(); - isolate_ = NULL; + isolate_ = nullptr; delete array_buffer_allocator_; Test::TearDownTestCase(); } @@ -64,10 +60,20 @@ Local<Value> TestWithIsolate::RunJS(const char* source) { return script->Run(isolate()->GetCurrentContext()).ToLocalChecked(); } +Local<Value> TestWithIsolate::RunJS( + String::ExternalOneByteStringResource* source) { + Local<Script> script = + v8::Script::Compile( + isolate()->GetCurrentContext(), + v8::String::NewExternalOneByte(isolate(), source).ToLocalChecked()) + .ToLocalChecked(); + return script->Run(isolate()->GetCurrentContext()).ToLocalChecked(); +} + TestWithContext::TestWithContext() : context_(Context::New(isolate())), context_scope_(context_) {} -TestWithContext::~TestWithContext() {} +TestWithContext::~TestWithContext() = default; v8::Local<v8::String> TestWithContext::NewString(const char* string) { return v8::String::NewFromUtf8(v8_isolate(), string, @@ -85,9 +91,9 @@ void TestWithContext::SetGlobalProperty(const char* name, namespace internal { -TestWithIsolate::~TestWithIsolate() {} +TestWithIsolate::~TestWithIsolate() = default; -TestWithIsolateAndZone::~TestWithIsolateAndZone() {} +TestWithIsolateAndZone::~TestWithIsolateAndZone() = default; Factory* TestWithIsolate::factory() const { return isolate()->factory(); } @@ -95,13 +101,18 @@ Handle<Object> TestWithIsolate::RunJSInternal(const char* source) { return Utils::OpenHandle(*::v8::TestWithIsolate::RunJS(source)); } +Handle<Object> TestWithIsolate::RunJSInternal( + ::v8::String::ExternalOneByteStringResource* source) { + return Utils::OpenHandle(*::v8::TestWithIsolate::RunJS(source)); +} + base::RandomNumberGenerator* TestWithIsolate::random_number_generator() const { return isolate()->random_number_generator(); } -TestWithZone::~TestWithZone() {} +TestWithZone::~TestWithZone() = default; -TestWithNativeContext::~TestWithNativeContext() {} +TestWithNativeContext::~TestWithNativeContext() = default; Handle<Context> TestWithNativeContext::native_context() const { return isolate()->native_context(); |