| 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 "include/libplatform/libplatform.h" | 5 #include "include/libplatform/libplatform.h" |
| 6 #include "src/compiler/compiler-unittests.h" | 6 #include "src/compiler/compiler-unittests.h" |
| 7 #include "src/isolate-inl.h" | 7 #include "src/isolate-inl.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 | 9 |
| 10 using testing::IsNull; | 10 using testing::IsNull; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 Test::TearDownTestCase(); | 48 Test::TearDownTestCase(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace compiler | 51 } // namespace compiler |
| 52 } // namespace internal | 52 } // namespace internal |
| 53 } // namespace v8 | 53 } // namespace v8 |
| 54 | 54 |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| 57 | 57 |
| 58 class CompilerTestEnvironment V8_FINAL : public ::testing::Environment { | 58 class CompilerTestEnvironment FINAL : public ::testing::Environment { |
| 59 public: | 59 public: |
| 60 CompilerTestEnvironment() : platform_(NULL) {} | 60 CompilerTestEnvironment() : platform_(NULL) {} |
| 61 ~CompilerTestEnvironment() {} | 61 ~CompilerTestEnvironment() {} |
| 62 | 62 |
| 63 virtual void SetUp() V8_OVERRIDE { | 63 virtual void SetUp() OVERRIDE { |
| 64 EXPECT_THAT(platform_, IsNull()); | 64 EXPECT_THAT(platform_, IsNull()); |
| 65 platform_ = v8::platform::CreateDefaultPlatform(); | 65 platform_ = v8::platform::CreateDefaultPlatform(); |
| 66 v8::V8::InitializePlatform(platform_); | 66 v8::V8::InitializePlatform(platform_); |
| 67 ASSERT_TRUE(v8::V8::Initialize()); | 67 ASSERT_TRUE(v8::V8::Initialize()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 virtual void TearDown() V8_OVERRIDE { | 70 virtual void TearDown() OVERRIDE { |
| 71 ASSERT_THAT(platform_, NotNull()); | 71 ASSERT_THAT(platform_, NotNull()); |
| 72 v8::V8::Dispose(); | 72 v8::V8::Dispose(); |
| 73 v8::V8::ShutdownPlatform(); | 73 v8::V8::ShutdownPlatform(); |
| 74 delete platform_; | 74 delete platform_; |
| 75 platform_ = NULL; | 75 platform_ = NULL; |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 v8::Platform* platform_; | 79 v8::Platform* platform_; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 | 84 |
| 85 int main(int argc, char** argv) { | 85 int main(int argc, char** argv) { |
| 86 testing::InitGoogleMock(&argc, argv); | 86 testing::InitGoogleMock(&argc, argv); |
| 87 testing::AddGlobalTestEnvironment(new CompilerTestEnvironment); | 87 testing::AddGlobalTestEnvironment(new CompilerTestEnvironment); |
| 88 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 88 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
| 89 return RUN_ALL_TESTS(); | 89 return RUN_ALL_TESTS(); |
| 90 } | 90 } |
| OLD | NEW |