Commit 152f6c3c authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

SkiaRenderer support for LayerWithRealCompositorTest and SnapshotAuraTest

This CL makes LayerWithRealCompositorTest and SnapshotAuraTest
parameterized to run using GLRenderer and SkiaRenderer. It adds
new constructor to TestContextFactories with parameter to specify which
renderer to use. Old constructor selects renderer based on feature state.

Bug: 956144
Change-Id: I153c15359f213f25142b4ae705b78b2bb4d6db7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1716924Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681337}
parent 52b0fda0
This diff is collapsed.
......@@ -5,6 +5,7 @@
#include "ui/compositor/test/test_context_factories.h"
#include "base/command_line.h"
#include "components/viz/common/features.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
......@@ -14,7 +15,11 @@
namespace ui {
TestContextFactories::TestContextFactories(bool enable_pixel_output) {
TestContextFactories::TestContextFactories(bool enable_pixel_output)
: TestContextFactories(enable_pixel_output,
features::IsUsingSkiaRenderer()) {}
TestContextFactories::TestContextFactories(bool enable_pixel_output,
bool use_skia_renderer) {
auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kEnablePixelOutputInTests))
enable_pixel_output = true;
......@@ -25,7 +30,8 @@ TestContextFactories::TestContextFactories(bool enable_pixel_output) {
std::make_unique<viz::FrameSinkManagerImpl>(shared_bitmap_manager_.get());
host_frame_sink_manager_ = std::make_unique<viz::HostFrameSinkManager>();
implicit_factory_ = std::make_unique<InProcessContextFactory>(
host_frame_sink_manager_.get(), frame_sink_manager_.get());
host_frame_sink_manager_.get(), frame_sink_manager_.get(),
use_skia_renderer);
implicit_factory_->SetUseFastRefreshRateForTests();
// Directly connect without using Mojo.
......
......@@ -30,6 +30,7 @@ class ContextFactoryPrivate;
class TestContextFactories {
public:
explicit TestContextFactories(bool enable_pixel_output);
TestContextFactories(bool enable_pixel_output, bool use_skia_renderer);
~TestContextFactories();
TestContextFactories(const TestContextFactories&) = delete;
......
......@@ -90,7 +90,8 @@ size_t GetFailedPixelsCount(const gfx::Image& image) {
} // namespace
class SnapshotAuraTest : public testing::Test {
// Param specifies whether to use SkiaRenderer or not
class SnapshotAuraTest : public testing::TestWithParam<bool> {
public:
SnapshotAuraTest() {}
~SnapshotAuraTest() override {}
......@@ -105,8 +106,8 @@ class SnapshotAuraTest : public testing::Test {
// The ContextFactory must exist before any Compositors are created.
// Snapshot test tests real drawing and readback, so needs pixel output.
const bool enable_pixel_output = true;
context_factories_ =
std::make_unique<ui::TestContextFactories>(enable_pixel_output);
context_factories_ = std::make_unique<ui::TestContextFactories>(
enable_pixel_output, GetParam());
helper_ = std::make_unique<aura::test::AuraTestHelper>();
helper_->SetUp(context_factories_->GetContextFactory(),
......@@ -191,13 +192,15 @@ class SnapshotAuraTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(SnapshotAuraTest);
};
INSTANTIATE_TEST_SUITE_P(, SnapshotAuraTest, ::testing::Bool());
#if defined(OS_WIN) && !defined(NDEBUG)
// https://crbug.com/852512
#define MAYBE_FullScreenWindow DISABLED_FullScreenWindow
#else
#define MAYBE_FullScreenWindow FullScreenWindow
#endif
TEST_F(SnapshotAuraTest, MAYBE_FullScreenWindow) {
TEST_P(SnapshotAuraTest, MAYBE_FullScreenWindow) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......@@ -213,7 +216,7 @@ TEST_F(SnapshotAuraTest, MAYBE_FullScreenWindow) {
EXPECT_EQ(0u, GetFailedPixelsCount(snapshot));
}
TEST_F(SnapshotAuraTest, PartialBounds) {
TEST_P(SnapshotAuraTest, PartialBounds) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......@@ -229,7 +232,7 @@ TEST_F(SnapshotAuraTest, PartialBounds) {
EXPECT_EQ(0u, GetFailedPixelsCount(snapshot));
}
TEST_F(SnapshotAuraTest, Rotated) {
TEST_P(SnapshotAuraTest, Rotated) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......@@ -247,7 +250,7 @@ TEST_F(SnapshotAuraTest, Rotated) {
EXPECT_EQ(0u, GetFailedPixelsCount(snapshot));
}
TEST_F(SnapshotAuraTest, UIScale) {
TEST_P(SnapshotAuraTest, UIScale) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......@@ -271,7 +274,7 @@ TEST_F(SnapshotAuraTest, UIScale) {
EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 1 / kUIScale));
}
TEST_F(SnapshotAuraTest, DeviceScaleFactor) {
TEST_P(SnapshotAuraTest, DeviceScaleFactor) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......@@ -294,7 +297,7 @@ TEST_F(SnapshotAuraTest, DeviceScaleFactor) {
EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2));
}
TEST_F(SnapshotAuraTest, RotateAndUIScale) {
TEST_P(SnapshotAuraTest, RotateAndUIScale) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......@@ -319,7 +322,7 @@ TEST_F(SnapshotAuraTest, RotateAndUIScale) {
EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 1 / kUIScale));
}
TEST_F(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) {
TEST_P(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) {
#if defined(OS_WIN)
// TODO(https://crbug.com/850556): Make work on Win10.
base::win::Version version = base::win::GetVersion();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment