| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 Factory* factory() const; | 88 Factory* factory() const; |
| 89 Isolate* isolate() const { | 89 Isolate* isolate() const { |
| 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 | |
| 99 class TestWithZone : public virtual ::testing::Test { | 98 class TestWithZone : public virtual ::testing::Test { |
| 100 public: | 99 public: |
| 101 TestWithZone() : zone_(&allocator_) {} | 100 TestWithZone() : zone_(&allocator_) {} |
| 102 virtual ~TestWithZone(); | 101 virtual ~TestWithZone(); |
| 103 | 102 |
| 104 Zone* zone() { return &zone_; } | 103 Zone* zone() { return &zone_; } |
| 105 | 104 |
| 106 private: | 105 private: |
| 107 v8::internal::AccountingAllocator allocator_; | 106 v8::internal::AccountingAllocator allocator_; |
| 108 Zone zone_; | 107 Zone zone_; |
| 109 | 108 |
| 110 DISALLOW_COPY_AND_ASSIGN(TestWithZone); | 109 DISALLOW_COPY_AND_ASSIGN(TestWithZone); |
| 111 }; | 110 }; |
| 112 | 111 |
| 113 | |
| 114 class TestWithIsolateAndZone : public virtual TestWithIsolate { | 112 class TestWithIsolateAndZone : public virtual TestWithIsolate { |
| 115 public: | 113 public: |
| 116 TestWithIsolateAndZone() : zone_(&allocator_) {} | 114 TestWithIsolateAndZone() : zone_(&allocator_) {} |
| 117 virtual ~TestWithIsolateAndZone(); | 115 virtual ~TestWithIsolateAndZone(); |
| 118 | 116 |
| 119 Zone* zone() { return &zone_; } | 117 Zone* zone() { return &zone_; } |
| 120 | 118 |
| 121 private: | 119 private: |
| 122 v8::internal::AccountingAllocator allocator_; | 120 v8::internal::AccountingAllocator allocator_; |
| 123 Zone zone_; | 121 Zone zone_; |
| 124 | 122 |
| 125 DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone); | 123 DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone); |
| 126 }; | 124 }; |
| 127 | 125 |
| 126 class TestWithNativeContext : public virtual ::v8::TestWithContext, |
| 127 public virtual TestWithIsolate { |
| 128 public: |
| 129 TestWithNativeContext() {} |
| 130 virtual ~TestWithNativeContext(); |
| 131 |
| 132 Handle<Context> native_context() const; |
| 133 |
| 134 private: |
| 135 DISALLOW_COPY_AND_ASSIGN(TestWithNativeContext); |
| 136 }; |
| 137 |
| 128 } // namespace internal | 138 } // namespace internal |
| 129 } // namespace v8 | 139 } // namespace v8 |
| 130 | 140 |
| 131 #endif // V8_UNITTESTS_TEST_UTILS_H_ | 141 #endif // V8_UNITTESTS_TEST_UTILS_H_ |
| OLD | NEW |