1// Copyright 2014 the V8 project 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.
4
5#include "src/test/test-utils.h"
6
7#include "src/isolate-inl.h"
8
9namespace v8 {
10
11// static
12Isolate* TestWithIsolate::isolate_ = NULL;
13
14
15TestWithIsolate::TestWithIsolate()
16    : isolate_scope_(isolate()), handle_scope_(isolate()) {}
17
18
19TestWithIsolate::~TestWithIsolate() {}
20
21
22// static
23void TestWithIsolate::SetUpTestCase() {
24  Test::SetUpTestCase();
25  EXPECT_EQ(NULL, isolate_);
26  isolate_ = v8::Isolate::New();
27  EXPECT_TRUE(isolate_ != NULL);
28}
29
30
31// static
32void TestWithIsolate::TearDownTestCase() {
33  ASSERT_TRUE(isolate_ != NULL);
34  isolate_->Dispose();
35  isolate_ = NULL;
36  Test::TearDownTestCase();
37}
38
39
40TestWithContext::TestWithContext()
41    : context_(Context::New(isolate())), context_scope_(context_) {}
42
43
44TestWithContext::~TestWithContext() {}
45
46
47namespace internal {
48
49TestWithIsolate::~TestWithIsolate() {}
50
51
52Factory* TestWithIsolate::factory() const { return isolate()->factory(); }
53
54
55TestWithZone::~TestWithZone() {}
56
57}  // namespace internal
58}  // namespace v8
59