Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / v8 / src / test / test-utils.cc
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
9 namespace v8 {
10
11 // static
12 Isolate* TestWithIsolate::isolate_ = NULL;
13
14
15 TestWithIsolate::TestWithIsolate()
16     : isolate_scope_(isolate()), handle_scope_(isolate()) {}
17
18
19 TestWithIsolate::~TestWithIsolate() {}
20
21
22 // static
23 void 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
32 void TestWithIsolate::TearDownTestCase() {
33   ASSERT_TRUE(isolate_ != NULL);
34   isolate_->Dispose();
35   isolate_ = NULL;
36   Test::TearDownTestCase();
37 }
38
39
40 TestWithContext::TestWithContext()
41     : context_(Context::New(isolate())), context_scope_(context_) {}
42
43
44 TestWithContext::~TestWithContext() {}
45
46
47 namespace internal {
48
49 TestWithIsolate::~TestWithIsolate() {}
50
51
52 Factory* TestWithIsolate::factory() const { return isolate()->factory(); }
53
54
55 TestWithZone::~TestWithZone() {}
56
57 }  // namespace internal
58 }  // namespace v8