Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
v8_test_environment.h
Go to the documentation of this file.
1// Copyright 2020 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef TESTING_V8_TEST_ENVIRONMENT_H_
6#define TESTING_V8_TEST_ENVIRONMENT_H_
7
8#ifndef PDF_ENABLE_V8
9#error "V8 must be enabled"
10#endif // PDF_ENABLE_V8
11
12#include <memory>
13
14#include "fxjs/cfx_v8.h"
15#include "fxjs/cfx_v8_array_buffer_allocator.h"
16#include "testing/gtest/include/gtest/gtest.h"
17
18namespace v8 {
19class Isolate;
20class Platform;
21class StartupData;
22} // namespace v8
23
24class TestLoader;
25
27 public:
28 explicit V8TestEnvironment(const char* exe_path);
30
31 // Note: GetInstance() does not create one if it does not exist,
32 // so the main program must explicitly add this enviroment.
34 static void PumpPlatformMessageLoop(v8::Isolate* pIsolate);
35
36 // testing::Environment:
37 void SetUp() override;
38 void TearDown() override;
39
40 v8::Platform* platform() const { return platform_.get(); }
41 v8::Isolate* isolate() const { return isolate_.get(); }
42
43 private:
44 const char* const exe_path_;
45 std::unique_ptr<v8::StartupData> startup_data_;
46 std::unique_ptr<v8::Platform> platform_;
47 std::unique_ptr<CFX_V8ArrayBufferAllocator> array_buffer_allocator_;
48 std::unique_ptr<v8::Isolate, CFX_V8IsolateDeleter> isolate_;
49};
50
51#endif // TESTING_V8_TEST_ENVIRONMENT_H_
cppgc::Heap * heap() const
void SetUp() override
void ForceGCAndPump()
void TearDown() override
~FXGCUnitTest() override
GCedTreeNodeMixinUnitTest()=default
void AddClutterToBack(ObservableGCedTreeNodeMixinForTest *parent)
~GCedTreeNodeMixinUnitTest() override=default
ObservableGCedTreeNodeMixinForTest * root() const
ObservableGCedTreeNodeMixinForTest * CreateNode()
void AddClutterToFront(ObservableGCedTreeNodeMixinForTest *parent)
v8::Platform * platform() const
v8::Isolate * isolate() const
V8TestEnvironment(const char *exe_path)
static void PumpPlatformMessageLoop(v8::Isolate *pIsolate)
static V8TestEnvironment * GetInstance()
TEST_F(GCedTreeNodeMixinUnitTest, OneRefence)
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
Definition heap.h:12