OLD | NEW |
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" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return reinterpret_cast<Isolate*>(::v8::TestWithIsolate::isolate()); | 90 return reinterpret_cast<Isolate*>(::v8::TestWithIsolate::isolate()); |
91 } | 91 } |
92 base::RandomNumberGenerator* random_number_generator() const; | 92 base::RandomNumberGenerator* random_number_generator() const; |
93 | 93 |
94 private: | 94 private: |
95 DISALLOW_COPY_AND_ASSIGN(TestWithIsolate); | 95 DISALLOW_COPY_AND_ASSIGN(TestWithIsolate); |
96 }; | 96 }; |
97 | 97 |
98 class TestWithZone : public virtual ::testing::Test { | 98 class TestWithZone : public virtual ::testing::Test { |
99 public: | 99 public: |
100 TestWithZone() : zone_(&allocator_) {} | 100 TestWithZone() : zone_(&allocator_, ZONE_NAME) {} |
101 virtual ~TestWithZone(); | 101 virtual ~TestWithZone(); |
102 | 102 |
103 Zone* zone() { return &zone_; } | 103 Zone* zone() { return &zone_; } |
104 | 104 |
105 private: | 105 private: |
106 v8::internal::AccountingAllocator allocator_; | 106 v8::internal::AccountingAllocator allocator_; |
107 Zone zone_; | 107 Zone zone_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(TestWithZone); | 109 DISALLOW_COPY_AND_ASSIGN(TestWithZone); |
110 }; | 110 }; |
111 | 111 |
112 class TestWithIsolateAndZone : public virtual TestWithIsolate { | 112 class TestWithIsolateAndZone : public virtual TestWithIsolate { |
113 public: | 113 public: |
114 TestWithIsolateAndZone() : zone_(&allocator_) {} | 114 TestWithIsolateAndZone() : zone_(&allocator_, ZONE_NAME) {} |
115 virtual ~TestWithIsolateAndZone(); | 115 virtual ~TestWithIsolateAndZone(); |
116 | 116 |
117 Zone* zone() { return &zone_; } | 117 Zone* zone() { return &zone_; } |
118 | 118 |
119 private: | 119 private: |
120 v8::internal::AccountingAllocator allocator_; | 120 v8::internal::AccountingAllocator allocator_; |
121 Zone zone_; | 121 Zone zone_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone); | 123 DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone); |
124 }; | 124 }; |
125 | 125 |
126 class TestWithNativeContext : public virtual ::v8::TestWithContext, | 126 class TestWithNativeContext : public virtual ::v8::TestWithContext, |
127 public virtual TestWithIsolate { | 127 public virtual TestWithIsolate { |
128 public: | 128 public: |
129 TestWithNativeContext() {} | 129 TestWithNativeContext() {} |
130 virtual ~TestWithNativeContext(); | 130 virtual ~TestWithNativeContext(); |
131 | 131 |
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_ |
OLD | NEW |