Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/unittests/test-utils.h

Issue 2679193004: [Compiler] Ensure we enter the correct context for compiler-dispatcher jobs. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 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 #ifndef V8_UNITTESTS_TEST_UTILS_H_ 5 #ifndef V8_UNITTESTS_TEST_UTILS_H_
6 #define V8_UNITTESTS_TEST_UTILS_H_ 6 #define V8_UNITTESTS_TEST_UTILS_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/base/macros.h" 9 #include "src/base/macros.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
11 #include "src/zone/accounting-allocator.h" 11 #include "src/zone/accounting-allocator.h"
12 #include "src/zone/zone.h" 12 #include "src/zone/zone.h"
13 #include "testing/gtest-support.h" 13 #include "testing/gtest-support.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 16
17 class ArrayBufferAllocator; 17 class ArrayBufferAllocator;
18 18
19 19
20 class TestWithIsolate : public virtual ::testing::Test { 20 class TestWithIsolate : public virtual ::testing::Test {
21 public: 21 public:
22 TestWithIsolate(); 22 TestWithIsolate();
23 virtual ~TestWithIsolate(); 23 virtual ~TestWithIsolate();
24 24
25 Isolate* isolate() const { return isolate_; } 25 Isolate* isolate() const { return isolate_; }
26 26
27 v8::internal::Isolate* i_isolate() const {
28 return reinterpret_cast<v8::internal::Isolate*>(isolate());
29 }
30
27 static void SetUpTestCase(); 31 static void SetUpTestCase();
28 static void TearDownTestCase(); 32 static void TearDownTestCase();
29 33
30 private: 34 private:
31 static v8::ArrayBuffer::Allocator* array_buffer_allocator_; 35 static v8::ArrayBuffer::Allocator* array_buffer_allocator_;
32 static Isolate* isolate_; 36 static Isolate* isolate_;
33 Isolate::Scope isolate_scope_; 37 Isolate::Scope isolate_scope_;
34 HandleScope handle_scope_; 38 HandleScope handle_scope_;
35 39
36 DISALLOW_COPY_AND_ASSIGN(TestWithIsolate); 40 DISALLOW_COPY_AND_ASSIGN(TestWithIsolate);
37 }; 41 };
38 42
39 43
40 class TestWithContext : public virtual TestWithIsolate { 44 class TestWithContext : public virtual TestWithIsolate {
41 public: 45 public:
42 TestWithContext(); 46 TestWithContext();
43 virtual ~TestWithContext(); 47 virtual ~TestWithContext();
44 48
45 const Local<Context>& context() const { return context_; } 49 const Local<Context>& context() const { return context_; }
46 50
47 v8::internal::Isolate* i_isolate() const {
48 return reinterpret_cast<v8::internal::Isolate*>(isolate());
49 }
50
51 private: 51 private:
52 Local<Context> context_; 52 Local<Context> context_;
53 Context::Scope context_scope_; 53 Context::Scope context_scope_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(TestWithContext); 55 DISALLOW_COPY_AND_ASSIGN(TestWithContext);
56 }; 56 };
57 57
58 58
59 namespace base { 59 namespace base {
60 60
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Handle<Context> native_context() const; 132 Handle<Context> native_context() const;
133 133
134 private: 134 private:
135 DISALLOW_COPY_AND_ASSIGN(TestWithNativeContext); 135 DISALLOW_COPY_AND_ASSIGN(TestWithNativeContext);
136 }; 136 };
137 137
138 } // namespace internal 138 } // namespace internal
139 } // namespace v8 139 } // namespace v8
140 140
141 #endif // V8_UNITTESTS_TEST_UTILS_H_ 141 #endif // V8_UNITTESTS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698