| OLD | NEW |
| (Empty) |
| 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 "include/libplatform/libplatform.h" | |
| 6 #include "include/v8.h" | |
| 7 #include "testing/gmock/include/gmock/gmock.h" | |
| 8 | |
| 9 using testing::IsNull; | |
| 10 using testing::NotNull; | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 class HeapTestEnvironment V8_FINAL : public ::testing::Environment { | |
| 15 public: | |
| 16 HeapTestEnvironment() : platform_(NULL) {} | |
| 17 virtual ~HeapTestEnvironment() {} | |
| 18 | |
| 19 virtual void SetUp() V8_OVERRIDE { | |
| 20 EXPECT_THAT(platform_, IsNull()); | |
| 21 platform_ = v8::platform::CreateDefaultPlatform(); | |
| 22 v8::V8::InitializePlatform(platform_); | |
| 23 ASSERT_TRUE(v8::V8::Initialize()); | |
| 24 } | |
| 25 | |
| 26 virtual void TearDown() V8_OVERRIDE { | |
| 27 ASSERT_THAT(platform_, NotNull()); | |
| 28 v8::V8::Dispose(); | |
| 29 v8::V8::ShutdownPlatform(); | |
| 30 delete platform_; | |
| 31 platform_ = NULL; | |
| 32 } | |
| 33 | |
| 34 private: | |
| 35 v8::Platform* platform_; | |
| 36 }; | |
| 37 | |
| 38 } // namespace | |
| 39 | |
| 40 | |
| 41 int main(int argc, char** argv) { | |
| 42 testing::InitGoogleMock(&argc, argv); | |
| 43 testing::AddGlobalTestEnvironment(new HeapTestEnvironment); | |
| 44 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | |
| 45 return RUN_ALL_TESTS(); | |
| 46 } | |
| OLD | NEW |