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 #include "test/unittests/test-utils.h" | 5 #include "test/unittests/test-utils.h" |
6 | 6 |
| 7 #include "src/base/platform/time.h" |
| 8 #include "src/flags.h" |
7 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
8 | 10 |
9 namespace v8 { | 11 namespace v8 { |
10 | 12 |
11 // static | 13 // static |
12 Isolate* TestWithIsolate::isolate_ = NULL; | 14 Isolate* TestWithIsolate::isolate_ = NULL; |
13 | 15 |
14 | 16 |
15 TestWithIsolate::TestWithIsolate() | 17 TestWithIsolate::TestWithIsolate() |
16 : isolate_scope_(isolate()), handle_scope_(isolate()) {} | 18 : isolate_scope_(isolate()), handle_scope_(isolate()) {} |
(...skipping 20 matching lines...) Expand all Loading... |
37 } | 39 } |
38 | 40 |
39 | 41 |
40 TestWithContext::TestWithContext() | 42 TestWithContext::TestWithContext() |
41 : context_(Context::New(isolate())), context_scope_(context_) {} | 43 : context_(Context::New(isolate())), context_scope_(context_) {} |
42 | 44 |
43 | 45 |
44 TestWithContext::~TestWithContext() {} | 46 TestWithContext::~TestWithContext() {} |
45 | 47 |
46 | 48 |
| 49 namespace base { |
| 50 namespace { |
| 51 |
| 52 inline int64_t GetRandomSeedFromFlag(int random_seed) { |
| 53 return random_seed ? random_seed : TimeTicks::Now().ToInternalValue(); |
| 54 } |
| 55 |
| 56 } // namespace |
| 57 |
| 58 TestWithRandomNumberGenerator::TestWithRandomNumberGenerator() |
| 59 : rng_(GetRandomSeedFromFlag(internal::FLAG_random_seed)) {} |
| 60 |
| 61 |
| 62 TestWithRandomNumberGenerator::~TestWithRandomNumberGenerator() {} |
| 63 |
| 64 } // namespace base |
| 65 |
| 66 |
47 namespace internal { | 67 namespace internal { |
48 | 68 |
49 TestWithIsolate::~TestWithIsolate() {} | 69 TestWithIsolate::~TestWithIsolate() {} |
50 | 70 |
51 | 71 |
52 Factory* TestWithIsolate::factory() const { return isolate()->factory(); } | 72 Factory* TestWithIsolate::factory() const { return isolate()->factory(); } |
53 | 73 |
54 | 74 |
55 TestWithZone::~TestWithZone() {} | 75 TestWithZone::~TestWithZone() {} |
56 | 76 |
57 } // namespace internal | 77 } // namespace internal |
58 } // namespace v8 | 78 } // namespace v8 |
OLD | NEW |