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

/*
 * Copyright (C) 2011 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 */

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

#include <list>
#include <memory>
#include <utility>

#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "cc/base/features.h"
#include "cc/layers/texture_layer.h"
#include "cc/paint/paint_flags.h"
#include "cc/test/skia_common.h"
#include "cc/test/stub_decode_cache.h"
#include "components/viz/test/test_context_provider.h"
#include "components/viz/test/test_gles2_interface.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_host.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h"
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/test/fake_canvas_resource_host.h"
#include "third_party/blink/renderer/platform/graphics/test/gpu_memory_buffer_test_platform.h"
#include "third_party/blink/renderer/platform/graphics/test/gpu_test_utils.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"

namespace blink {

namespace {

_;
AnyNumber;
AtLeast;
InSequence;
Pointee;
Return;
SetArgPointee;
Test;

class AcceleratedCompositingTestPlatform
    : public blink::TestingPlatformSupport {};

}  // namespace

class Canvas2DLayerBridgeTest : public Test {};

TEST_F(Canvas2DLayerBridgeTest, DisableAcceleration) {}

TEST_F(Canvas2DLayerBridgeTest, NoDrawOnContextLost) {}

TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhenContextIsLost) {}

TEST_F(Canvas2DLayerBridgeTest,
       PrepareMailboxWhenContextIsLostWithFailedRestore) {}

TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxAndLoseResource) {}

TEST_F(Canvas2DLayerBridgeTest, ReleaseCallbackWithNullContextProviderWrapper) {}

TEST_F(Canvas2DLayerBridgeTest, RasterModeHint) {}

TEST_F(Canvas2DLayerBridgeTest, FallbackToSoftwareIfContextLost) {}

void DrawSomething(Canvas2DLayerBridge* bridge) {}

TEST_F(Canvas2DLayerBridgeTest, FallbackToSoftwareOnFailedTextureAlloc) {}

class MockLogger : public Canvas2DLayerBridge::Logger {};

TEST_F(Canvas2DLayerBridgeTest, HibernationLifeCycle) {}

TEST_F(Canvas2DLayerBridgeTest, HibernationReEntry) {}

TEST_F(Canvas2DLayerBridgeTest, TeardownWhileHibernating) {}

TEST_F(Canvas2DLayerBridgeTest, SnapshotWhileHibernating) {}

TEST_F(Canvas2DLayerBridgeTest, TeardownWhileHibernationIsPending) {}

TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToVisibilityChange) {}

TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToLostContext) {}

TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhileHibernating) {}

TEST_F(Canvas2DLayerBridgeTest, ResourceRecycling) {}

TEST_F(Canvas2DLayerBridgeTest, NoResourceRecyclingWhenPageHidden) {}

TEST_F(Canvas2DLayerBridgeTest,
       PrepareTransferableResourceTracksCanvasChanges) {}

class CustomFakeCanvasResourceHost : public FakeCanvasResourceHost {};

TEST_F(Canvas2DLayerBridgeTest, WritePixelsRestoresClipStack) {}

TEST_F(Canvas2DLayerBridgeTest, DisplayedCanvasIsRateLimited) {}

TEST_F(Canvas2DLayerBridgeTest, NonDisplayedCanvasIsNotRateLimited) {}

TEST_F(Canvas2DLayerBridgeTest, SoftwareCanvasIsCompositedIfImageChromium) {}

TEST_F(Canvas2DLayerBridgeTest, SoftwareCanvasNotCompositedIfNotImageChromium) {}

TEST_F(Canvas2DLayerBridgeTest, PushPropertiesAfterVisibilityChange) {}

}  // namespace blink