chromium/third_party/blink/renderer/platform/widget/compositing/layer_tree_view_unittest.cc

// Copyright 2014 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/widget/compositing/layer_tree_view.h"

#include <utility>

#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "cc/test/fake_layer_tree_frame_sink.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_ukm_recorder_factory.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/render_frame_metadata_observer.h"
#include "components/viz/test/test_context_provider.h"
#include "gpu/GLES2/gl2extchromium.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/public/platform/scheduler/test/web_fake_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/dummy_schedulers.h"
#include "third_party/blink/renderer/platform/scheduler/public/page_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/widget_scheduler.h"
#include "third_party/blink/renderer/platform/widget/compositing/test/stub_layer_tree_view_delegate.h"

AllOf;
Field;

namespace blink {
namespace {

enum FailureMode {};

class FakeLayerTreeViewDelegate : public StubLayerTreeViewDelegate {};

// Verify that failing to create an output surface will cause the compositor
// to attempt to repeatedly create another output surface.
// The use null output surface parameter allows testing whether failures
// from RenderWidget (couldn't create an output surface) vs failures from
// the compositor (couldn't bind the output surface) are handled identically.
class LayerTreeViewWithFrameSinkTracking : public LayerTreeView {};

class LayerTreeViewWithFrameSinkTrackingTest : public testing::Test {};

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, SucceedOnce) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, SucceedOnce_AfterNullChannel) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, SucceedOnce_AfterLostContext) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, SucceedTwice) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, SucceedTwice_AfterNullChannel) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, SucceedTwice_AfterLostContext) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, FailWithNullChannel) {}

TEST_F(LayerTreeViewWithFrameSinkTrackingTest, FailWithLostContext) {}

class VisibilityTestLayerTreeView : public LayerTreeView {};

TEST(LayerTreeViewTest, VisibilityTest) {}

// Tests that presentation callbacks are only called on successful
// presentations.
TEST(LayerTreeViewTest, RunPresentationCallbackOnSuccess) {}

class LayerTreeViewDelegateChangeTest : public testing::Test {};

TEST_F(LayerTreeViewDelegateChangeTest, NoFrameSink) {}

TEST_F(LayerTreeViewDelegateChangeTest, RequestBufferedBecauseInvisible) {}

TEST_F(LayerTreeViewDelegateChangeTest, RequestPendingBeforeSwap) {}

TEST_F(LayerTreeViewDelegateChangeTest, SwapDuringFrameSinkInitialization) {}

TEST_F(LayerTreeViewDelegateChangeTest, SwapAfterFrameSinkInitialization) {}

TEST_F(LayerTreeViewDelegateChangeTest, StopDeferringCommitsOnSwap) {}

TEST_F(LayerTreeViewDelegateChangeTest, ResetEventListenerPropertiesOnSwap) {}

}  // namespace
}  // namespace blink