blob: 538565ec4a6cf22898e98740f29e54b7ed77f6b3 [file] [log] [blame]
Tom Sepezeaf9d212020-07-22 16:24:00 +00001// Copyright 2020 PDFium 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
Tom Sepezf5397f02020-07-23 21:22:40 +00005#include "testing/fxgc_unittest.h"
Tom Sepezeaf9d212020-07-22 16:24:00 +00006
7#include "fxjs/gc/heap.h"
8#include "testing/gtest/include/gtest/gtest.h"
9#include "testing/v8_test_environment.h"
10
11FXGCUnitTest::FXGCUnitTest() = default;
12
13FXGCUnitTest::~FXGCUnitTest() = default;
14
15void FXGCUnitTest::SetUp() {
16 FXV8UnitTest::SetUp();
Tom Sepez5b2e5862020-09-23 22:03:45 +000017 auto* env = V8TestEnvironment::GetInstance();
18 FXGC_Initialize(env->platform(), env->isolate());
Tom Sepezeaf9d212020-07-22 16:24:00 +000019 heap_ = FXGC_CreateHeap();
20 ASSERT_TRUE(heap_);
21}
22
23void FXGCUnitTest::TearDown() {
Tom Sepez5b2e5862020-09-23 22:03:45 +000024 FXGC_ForceGarbageCollection(heap_.get());
25 auto* env = V8TestEnvironment::GetInstance();
26 while (v8::platform::PumpMessageLoop(env->platform(), env->isolate()))
27 continue;
28
Tom Sepezeaf9d212020-07-22 16:24:00 +000029 heap_.reset();
30 FXGC_Release();
31 FXV8UnitTest::TearDown();
32}