#include "src/execution/microtask-queue.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <vector>
#include "include/v8-function.h"
#include "src/heap/factory.h"
#include "src/objects/foreign.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/js-objects-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/promise-inl.h"
#include "src/objects/visitors.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
Closure;
void RunStdFunction(void* data) { … }
template <typename TMixin>
class WithFinalizationRegistryMixin : public TMixin { … };
template <typename TMixin>
SaveFlags* WithFinalizationRegistryMixin<TMixin>::save_flags_ = …;
using TestWithNativeContextAndFinalizationRegistry =
WithInternalIsolateMixin<
WithContextMixin<
WithFinalizationRegistryMixin<
WithIsolateScopeMixin<
WithIsolateMixin<
WithDefaultPlatformMixin<
::testing::Test>>>>>>;
namespace {
void DummyPromiseHook(PromiseHookType type, Local<Promise> promise,
Local<Value> parent) { … }
}
class MicrotaskQueueTest : public TestWithNativeContextAndFinalizationRegistry,
public ::testing::WithParamInterface<bool> { … };
class RecordingVisitor : public RootVisitor { … };
TEST_P(MicrotaskQueueTest, EnqueueAndRun) { … }
TEST_P(MicrotaskQueueTest, BufferGrowth) { … }
TEST_P(MicrotaskQueueTest, InstanceChain) { … }
TEST_P(MicrotaskQueueTest, VisitRoot) { … }
TEST_P(MicrotaskQueueTest, PromiseHandlerContext) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_Enqueue) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_Run) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_PromiseResolveThenableJobTask) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_ResolveThenableForeignThen) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_HandlerContext) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_Chain) { … }
TEST_P(MicrotaskQueueTest, DetachGlobal_InactiveHandler) { … }
TEST_P(MicrotaskQueueTest, MicrotasksScope) { … }
INSTANTIATE_TEST_SUITE_P(
, MicrotaskQueueTest, ::testing::Values(false, true),
[](const ::testing::TestParamInfo<MicrotaskQueueTest::ParamType>& info) { … };
}
}