chromium/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl_test.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.h"

#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_tick_clock.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator.h"
#include "third_party/blink/renderer/platform/graphics/compositor_mutator_client.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/scheduler/public/non_main_thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_type.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"

#include <memory>

_;
AtLeast;
Mock;
Return;
Sequence;
StrictMock;
Truly;

// This test uses actual threads since mutator logic requires it. This means we
// have dependency on Blink platform to create threads.

namespace blink {
namespace {

std::unique_ptr<NonMainThread> CreateThread(const char* name) {}

class MockAnimationWorkletMutator
    : public GarbageCollected<MockAnimationWorkletMutator>,
      public AnimationWorkletMutator {};

class MockCompositorMutatorClient : public CompositorMutatorClient {};

class AnimationWorkletMutatorDispatcherImplTest : public ::testing::Test {};

std::unique_ptr<AnimationWorkletDispatcherInput> CreateTestMutatorInput() {}

bool OnlyIncludesAnimation1(const AnimationWorkletInput& in) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       RegisteredAnimatorShouldOnlyReceiveInputForItself) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       RegisteredAnimatorShouldNotBeMutatedWhenNoInput) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       MutationUpdateIsNotInvokedWithNoRegisteredAnimators) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       MutationUpdateIsNotInvokedWithNullOutput) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       MutationUpdateIsInvokedCorrectlyWithSingleRegisteredAnimator) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       MutationUpdateInvokedCorrectlyWithTwoRegisteredAnimatorsOnSameThread) {}

TEST_F(
    AnimationWorkletMutatorDispatcherImplTest,
    MutationUpdateInvokedCorrectlyWithTwoRegisteredAnimatorsOnDifferentThreads) {}

TEST_F(AnimationWorkletMutatorDispatcherImplTest,
       DispatcherShouldNotHangWhenMutatorGoesAway) {}

// -----------------------------------------------------------------------
// Asynchronous version of tests.

MutatorDispatcherRef;

class AnimationWorkletMutatorDispatcherImplAsyncTest
    : public AnimationWorkletMutatorDispatcherImplTest {};

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       RegisteredAnimatorShouldOnlyReceiveInputForItself) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       RegisteredAnimatorShouldNotBeMutatedWhenNoInput) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateIsNotInvokedWithNoRegisteredAnimators) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateIsNotInvokedWithNullOutput) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateIsInvokedCorrectlyWithSingleRegisteredAnimator) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateInvokedCorrectlyWithTwoRegisteredAnimatorsOnSameThread) {}

TEST_F(
    AnimationWorkletMutatorDispatcherImplAsyncTest,
    MutationUpdateInvokedCorrectlyWithTwoRegisteredAnimatorsOnDifferentThreads) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateDroppedWhenBusy) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateQueuedWhenBusy) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateQueueWithReplacementWhenBusy) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest,
       MutationUpdateMultipleQueuesWhenBusy) {}

TEST_F(AnimationWorkletMutatorDispatcherImplAsyncTest, HistogramTester) {}

}  // namespace

}  // namespace blink