LayoutTestPermissionManager: pass top level origin, not URL.
[chromium-blink-merge.git] / gin / test / v8_test.cc
blobaad291d895756670ff39c519c53f69e6036f9392
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"
9 #include "gin/v8_initializer.h"
11 using v8::Context;
12 using v8::Local;
13 using v8::HandleScope;
15 namespace gin {
17 V8Test::V8Test() {
20 V8Test::~V8Test() {
23 void V8Test::SetUp() {
24 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
25 gin::V8Initializer::LoadV8Snapshot();
26 #endif
27 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
28 gin::ArrayBufferAllocator::SharedInstance());
30 instance_.reset(new gin::IsolateHolder);
31 instance_->isolate()->Enter();
32 HandleScope handle_scope(instance_->isolate());
33 context_.Reset(instance_->isolate(), Context::New(instance_->isolate()));
34 Local<Context>::New(instance_->isolate(), context_)->Enter();
37 void V8Test::TearDown() {
39 HandleScope handle_scope(instance_->isolate());
40 Local<Context>::New(instance_->isolate(), context_)->Exit();
41 context_.Reset();
43 instance_->isolate()->Exit();
44 instance_.reset();
47 } // namespace gin