blob: 9c9d2029d271db25f3f09e5b03201ed899b35034 [file] [log] [blame]
Avi Drissman468e51b62022-09-13 20:47:011// Copyright 2013 The Chromium Authors
[email protected]a22998a2013-11-10 05:00:502// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef GIN_TEST_V8_TEST_H_
6#define GIN_TEST_V8_TEST_H_
7
mostynbc862da82016-04-03 15:54:338#include <memory>
9
[email protected]a22998a2013-11-10 05:00:5010#include "base/compiler_specific.h"
Gabriel Charettec7108742019-08-23 03:31:4011#include "base/test/task_environment.h"
[email protected]a22998a2013-11-10 05:00:5012#include "testing/gtest/include/gtest/gtest.h"
Dan Elphick05acd602021-08-30 15:22:0713#include "v8/include/v8-forward.h"
14#include "v8/include/v8-persistent-handle.h"
[email protected]a22998a2013-11-10 05:00:5015
16namespace gin {
17
[email protected]f04b0e92013-11-22 14:20:5518class IsolateHolder;
[email protected]1b93c232013-11-19 19:25:1219
[email protected]60531d52013-11-27 02:10:1520// V8Test is a simple harness for testing interactions with V8. V8Test doesn't
21// have any dependencies on Gin's module system.
[email protected]a22998a2013-11-10 05:00:5022class V8Test : public testing::Test {
23 public:
24 V8Test();
Daniel Hosseinian68c0798d2021-04-16 08:16:0725 V8Test(const V8Test&) = delete;
26 V8Test& operator=(const V8Test&) = delete;
dchengd0139722014-12-29 22:58:2027 ~V8Test() override;
[email protected]a22998a2013-11-10 05:00:5028
dchengd0139722014-12-29 22:58:2029 void SetUp() override;
30 void TearDown() override;
[email protected]a22998a2013-11-10 05:00:5031
32 protected:
Ulan Degenbaevdc12d16a2018-09-06 15:12:1633 // This is used during SetUp() to initialize instance_.
34 virtual std::unique_ptr<IsolateHolder> CreateIsolateHolder() const;
Ulan Degenbaev4f2f1a12019-09-24 14:42:5735 base::test::TaskEnvironment task_environment_;
mostynbc862da82016-04-03 15:54:3336 std::unique_ptr<IsolateHolder> instance_;
[email protected]a22998a2013-11-10 05:00:5037 v8::Persistent<v8::Context> context_;
[email protected]a22998a2013-11-10 05:00:5038};
39
40} // namespace gin
41
42#endif // GIN_TEST_V8_TEST_H_