1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gin/test/v8_test.h"
7 #include "gin/array_buffer.h"
8 #include "gin/public/isolate_holder.h"
10 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
11 #include "gin/public/isolate_holder.h"
16 using v8::HandleScope;
26 void V8Test::SetUp() {
27 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
28 gin::IsolateHolder::LoadV8Snapshot();
30 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
31 gin::ArrayBufferAllocator::SharedInstance());
32 instance_.reset(new gin::IsolateHolder);
33 instance_->isolate()->Enter();
34 HandleScope handle_scope(instance_->isolate());
35 context_.Reset(instance_->isolate(), Context::New(instance_->isolate()));
36 Local<Context>::New(instance_->isolate(), context_)->Enter();
39 void V8Test::TearDown() {
41 HandleScope handle_scope(instance_->isolate());
42 Local<Context>::New(instance_->isolate(), context_)->Exit();
45 instance_->isolate()->Exit();