| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gin/test/v8_test.h" | 5 #include "gin/test/v8_test.h" |
| 6 | 6 |
| 7 #include "gin/gin.h" |
| 8 |
| 7 using v8::Context; | 9 using v8::Context; |
| 8 using v8::Local; | 10 using v8::Local; |
| 9 using v8::HandleScope; | 11 using v8::HandleScope; |
| 10 using v8::Isolate; | |
| 11 | 12 |
| 12 namespace gin { | 13 namespace gin { |
| 13 | 14 |
| 14 V8Test::V8Test() { | 15 V8Test::V8Test() { |
| 15 } | 16 } |
| 16 | 17 |
| 17 V8Test::~V8Test() { | 18 V8Test::~V8Test() { |
| 18 } | 19 } |
| 19 | 20 |
| 20 void V8Test::SetUp() { | 21 void V8Test::SetUp() { |
| 21 isolate_ = Isolate::GetCurrent(); | 22 instance_.reset(new gin::Gin); |
| 22 HandleScope handle_scope(isolate_); | 23 instance_->isolate()->Enter(); |
| 23 context_.Reset(isolate_, Context::New(isolate_)); | 24 HandleScope handle_scope(instance_->isolate()); |
| 24 Local<Context>::New(isolate_, context_)->Enter(); | 25 context_.Reset(instance_->isolate(), Context::New(instance_->isolate())); |
| 26 Local<Context>::New(instance_->isolate(), context_)->Enter(); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void V8Test::TearDown() { | 29 void V8Test::TearDown() { |
| 28 HandleScope handle_scope(isolate_); | 30 { |
| 29 Local<Context>::New(isolate_, context_)->Exit(); | 31 HandleScope handle_scope(instance_->isolate()); |
| 30 context_.Reset(); | 32 Local<Context>::New(instance_->isolate(), context_)->Exit(); |
| 33 context_.Reset(); |
| 34 } |
| 35 instance_->isolate()->Exit(); |
| 36 instance_.reset(); |
| 31 } | 37 } |
| 32 | 38 |
| 33 } // namespace gin | 39 } // namespace gin |
| OLD | NEW |