diff options
Diffstat (limited to 'deps/v8/test/unittests/run-all-unittests.cc')
-rw-r--r-- | deps/v8/test/unittests/run-all-unittests.cc | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/deps/v8/test/unittests/run-all-unittests.cc b/deps/v8/test/unittests/run-all-unittests.cc index 8437ac0acb..fba903688d 100644 --- a/deps/v8/test/unittests/run-all-unittests.cc +++ b/deps/v8/test/unittests/run-all-unittests.cc @@ -8,34 +8,21 @@ #include "include/libplatform/libplatform.h" #include "include/v8-initialization.h" #include "src/base/compiler-specific.h" +#include "src/base/page-allocator.h" #include "testing/gmock/include/gmock/gmock.h" namespace { -class DefaultPlatformEnvironment final : public ::testing::Environment { +class CppGCEnvironment final : public ::testing::Environment { public: - DefaultPlatformEnvironment() = default; - void SetUp() override { - platform_ = v8::platform::NewDefaultPlatform( - 0, v8::platform::IdleTaskSupport::kEnabled); - ASSERT_TRUE(platform_.get() != nullptr); - v8::V8::InitializePlatform(platform_.get()); -#ifdef V8_SANDBOX - ASSERT_TRUE(v8::V8::InitializeSandbox()); -#endif - cppgc::InitializeProcess(platform_->GetPageAllocator()); - v8::V8::Initialize(); - } - - void TearDown() override { - ASSERT_TRUE(platform_.get() != nullptr); - v8::V8::Dispose(); - v8::V8::DisposePlatform(); + // Initialize the process for cppgc with an arbitrary page allocator. This + // has to survive as long as the process, so it's ok to leak the allocator + // here. + cppgc::InitializeProcess(new v8::base::PageAllocator()); } - private: - std::unique_ptr<v8::Platform> platform_; + void TearDown() override { cppgc::ShutdownProcess(); } }; } // namespace @@ -50,7 +37,7 @@ int main(int argc, char** argv) { testing::FLAGS_gtest_death_test_style = "threadsafe"; testing::InitGoogleMock(&argc, argv); - testing::AddGlobalTestEnvironment(new DefaultPlatformEnvironment); + testing::AddGlobalTestEnvironment(new CppGCEnvironment); v8::V8::SetFlagsFromCommandLine(&argc, argv, true); v8::V8::InitializeExternalStartupData(argv[0]); v8::V8::InitializeICUDefaultLocation(argv[0]); |