Roll src/third_party/skia a9cb871:95d755d
[chromium-blink-merge.git] / gin / test / v8_test.cc
bloba02251128a2c1bd13f776e1ca7b6a6fe405749eb
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"
12 #endif
14 using v8::Context;
15 using v8::Local;
16 using v8::HandleScope;
18 namespace gin {
20 V8Test::V8Test() {
23 V8Test::~V8Test() {
26 void V8Test::SetUp() {
27 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
28 gin::IsolateHolder::LoadV8Snapshot();
29 #endif
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();
43 context_.Reset();
45 instance_->isolate()->Exit();
46 instance_.reset();
49 } // namespace gin