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 "include/v8.h" | 6 #include "include/v8.h" |
7 #include "src/base/compiler-specific.h" | 7 #include "src/base/compiler-specific.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 class DefaultPlatformEnvironment final : public ::testing::Environment { | 12 class DefaultPlatformEnvironment final : public ::testing::Environment { |
13 public: | 13 public: |
14 DefaultPlatformEnvironment() : platform_(NULL) {} | 14 DefaultPlatformEnvironment() : platform_(NULL) {} |
15 | 15 |
16 void SetUp() override { | 16 void SetUp() override { |
17 EXPECT_EQ(NULL, platform_); | 17 EXPECT_EQ(NULL, platform_); |
18 platform_ = v8::platform::CreateDefaultPlatform(); | 18 platform_ = v8::platform::CreateDefaultPlatform( |
| 19 0, v8::platform::IdleTaskSupport::kEnabled); |
19 ASSERT_TRUE(platform_ != NULL); | 20 ASSERT_TRUE(platform_ != NULL); |
20 v8::V8::InitializePlatform(platform_); | 21 v8::V8::InitializePlatform(platform_); |
21 ASSERT_TRUE(v8::V8::Initialize()); | 22 ASSERT_TRUE(v8::V8::Initialize()); |
22 } | 23 } |
23 | 24 |
24 void TearDown() override { | 25 void TearDown() override { |
25 ASSERT_TRUE(platform_ != NULL); | 26 ASSERT_TRUE(platform_ != NULL); |
26 v8::V8::Dispose(); | 27 v8::V8::Dispose(); |
27 v8::V8::ShutdownPlatform(); | 28 v8::V8::ShutdownPlatform(); |
28 delete platform_; | 29 delete platform_; |
(...skipping 10 matching lines...) Expand all Loading... |
39 int main(int argc, char** argv) { | 40 int main(int argc, char** argv) { |
40 // Don't catch SEH exceptions and continue as the following tests might hang | 41 // Don't catch SEH exceptions and continue as the following tests might hang |
41 // in an broken environment on windows. | 42 // in an broken environment on windows. |
42 testing::GTEST_FLAG(catch_exceptions) = false; | 43 testing::GTEST_FLAG(catch_exceptions) = false; |
43 testing::InitGoogleMock(&argc, argv); | 44 testing::InitGoogleMock(&argc, argv); |
44 testing::AddGlobalTestEnvironment(new DefaultPlatformEnvironment); | 45 testing::AddGlobalTestEnvironment(new DefaultPlatformEnvironment); |
45 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 46 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
46 v8::V8::InitializeExternalStartupData(argv[0]); | 47 v8::V8::InitializeExternalStartupData(argv[0]); |
47 return RUN_ALL_TESTS(); | 48 return RUN_ALL_TESTS(); |
48 } | 49 } |
OLD | NEW |