diff options
author | kalyan.kondapally <kalyan.kondapally@intel.com> | 2015-12-21 12:59:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-21 21:00:50 +0000 |
commit | c91094815164bc61091ead69981964d1471b2dd2 (patch) | |
tree | 315be5580bc47dab33e6068ee8e87d144d417d0e /ui/ozone | |
parent | 512186a7613d5d499bce19b45c8d0264e9c18448 (diff) | |
download | chromium_src-c91094815164bc61091ead69981964d1471b2dd2.zip chromium_src-c91094815164bc61091ead69981964d1471b2dd2.tar.gz chromium_src-c91094815164bc61091ead69981964d1471b2dd2.tar.bz2 |
Ozone: Add MockHardwareDisplayPlaneManager
Refactor tests to share as much code as possible and avoid need to
construct different Stubs for Scanout buffers, PlaneManager in
HardwareDisplayPlaneManagerTest and HardwareDisplayControllerTest.
BUG=553264
Review URL: https://codereview.chromium.org/1543493002
Cr-Commit-Position: refs/heads/master@{#366453}
Diffstat (limited to 'ui/ozone')
17 files changed, 364 insertions, 220 deletions
diff --git a/ui/ozone/platform/drm/BUILD.gn b/ui/ozone/platform/drm/BUILD.gn index 59ede14..f41e3ad 100644 --- a/ui/ozone/platform/drm/BUILD.gn +++ b/ui/ozone/platform/drm/BUILD.gn @@ -153,12 +153,18 @@ source_set("gbm_unittests") { testonly = true sources = [ "gpu/drm_window_unittest.cc", + "gpu/fake_plane_info.cc", + "gpu/fake_plane_info.h", "gpu/hardware_display_controller_unittest.cc", "gpu/hardware_display_plane_manager_unittest.cc", - "gpu/mock_buffer_generator.cc", - "gpu/mock_buffer_generator.h", "gpu/mock_drm_device.cc", "gpu/mock_drm_device.h", + "gpu/mock_dumb_buffer_generator.cc", + "gpu/mock_dumb_buffer_generator.h", + "gpu/mock_hardware_display_plane_manager.cc", + "gpu/mock_hardware_display_plane_manager.h", + "gpu/mock_scanout_buffer.cc", + "gpu/mock_scanout_buffer.h", "gpu/screen_manager_unittest.cc", ] diff --git a/ui/ozone/platform/drm/gbm.gypi b/ui/ozone/platform/drm/gbm.gypi index 2df9bb3..7cc797c 100644 --- a/ui/ozone/platform/drm/gbm.gypi +++ b/ui/ozone/platform/drm/gbm.gypi @@ -171,12 +171,18 @@ 'direct_dependent_settings': { 'sources': [ 'gpu/drm_window_unittest.cc', + 'gpu/fake_plane_info.cc', + 'gpu/fake_plane_info.h', 'gpu/hardware_display_controller_unittest.cc', 'gpu/hardware_display_plane_manager_unittest.cc', - 'gpu/mock_buffer_generator.cc', - 'gpu/mock_buffer_generator.h', + 'gpu/mock_dumb_buffer_generator.cc', + 'gpu/mock_dumb_buffer_generator.h', 'gpu/mock_drm_device.cc', 'gpu/mock_drm_device.h', + 'gpu/mock_hardware_display_plane_manager.cc', + 'gpu/mock_hardware_display_plane_manager.h', + 'gpu/mock_scanout_buffer.cc', + 'gpu/mock_scanout_buffer.h', 'gpu/screen_manager_unittest.cc', ], }, diff --git a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc index 9d9d0ec..8a5b670 100644 --- a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc @@ -15,8 +15,8 @@ #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" #include "ui/ozone/platform/drm/gpu/drm_window.h" #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" -#include "ui/ozone/platform/drm/gpu/mock_buffer_generator.h" #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" +#include "ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.h" #include "ui/ozone/platform/drm/gpu/screen_manager.h" #include "ui/ozone/public/surface_ozone_canvas.h" @@ -70,7 +70,7 @@ class DrmWindowTest : public testing::Test { protected: scoped_ptr<base::MessageLoop> message_loop_; scoped_refptr<ui::MockDrmDevice> drm_; - scoped_ptr<ui::MockBufferGenerator> buffer_generator_; + scoped_ptr<ui::MockDumbBufferGenerator> buffer_generator_; scoped_ptr<ui::ScreenManager> screen_manager_; scoped_ptr<ui::DrmDeviceManager> drm_device_manager_; @@ -87,7 +87,7 @@ void DrmWindowTest::SetUp() { message_loop_.reset(new base::MessageLoopForUI); drm_ = new ui::MockDrmDevice(); - buffer_generator_.reset(new ui::MockBufferGenerator()); + buffer_generator_.reset(new ui::MockDumbBufferGenerator()); screen_manager_.reset(new ui::ScreenManager(buffer_generator_.get())); screen_manager_->AddDisplayController(drm_, kDefaultCrtc, kDefaultConnector); screen_manager_->ConfigureDisplayController( @@ -161,7 +161,7 @@ TEST_F(DrmWindowTest, CheckCursorSurfaceAfterChangingDevice) { TEST_F(DrmWindowTest, CheckCallbackOnFailedSwap) { const gfx::Size window_size(6, 4); - ui::MockBufferGenerator buffer_generator; + ui::MockDumbBufferGenerator buffer_generator; ui::DrmWindow* window = screen_manager_->GetWindow(kDefaultWidgetHandle); ui::OverlayPlane plane( buffer_generator.Create(drm_, gfx::BufferFormat::BGRX_8888, window_size)); diff --git a/ui/ozone/platform/drm/gpu/fake_plane_info.cc b/ui/ozone/platform/drm/gpu/fake_plane_info.cc new file mode 100644 index 0000000..123d76f --- /dev/null +++ b/ui/ozone/platform/drm/gpu/fake_plane_info.cc @@ -0,0 +1,27 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <drm_fourcc.h> + +#include "ui/ozone/platform/drm/gpu/fake_plane_info.h" + +namespace ui { + +FakePlaneInfo::FakePlaneInfo(uint32_t crtc_id, uint32_t crtc_mask) { + id = crtc_id; + allowed_crtc_mask = crtc_mask; + allowed_formats.push_back(std::move(DRM_FORMAT_XRGB8888)); +} + +FakePlaneInfo::FakePlaneInfo(uint32_t crtc_id, + uint32_t crtc_mask, + const std::vector<uint32_t>& formats) { + id = crtc_id; + allowed_crtc_mask = crtc_mask; + allowed_formats = formats; +} + +FakePlaneInfo::~FakePlaneInfo() {} + +} // namespace ui diff --git a/ui/ozone/platform/drm/gpu/fake_plane_info.h b/ui/ozone/platform/drm/gpu/fake_plane_info.h new file mode 100644 index 0000000..338053e --- /dev/null +++ b/ui/ozone/platform/drm/gpu/fake_plane_info.h @@ -0,0 +1,28 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_DRM_GPU_FAKE_PLANE_INFO_H_ +#define UI_OZONE_PLATFORM_DRM_GPU_FAKE_PLANE_INFO_H_ + +#include <vector> + +#include "base/macros.h" + +namespace ui { + +struct FakePlaneInfo { + FakePlaneInfo(uint32_t crtc_id, uint32_t crtc_mask); + FakePlaneInfo(uint32_t crtc_id, + uint32_t crtc_mask, + const std::vector<uint32_t>& formats); + ~FakePlaneInfo(); + + uint32_t id; + uint32_t allowed_crtc_mask; + std::vector<uint32_t> allowed_formats; +}; + +} // namespace ui + +#endif // UI_OZONE_PLATFORM_DRM_GPU_FAKE_PLANE_INFO_H_ diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc b/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc index 6f1f065..c7bed2a 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc @@ -2,16 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <drm_fourcc.h> - #include "base/bind.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkCanvas.h" #include "ui/ozone/platform/drm/gpu/crtc_controller.h" -#include "ui/ozone/platform/drm/gpu/drm_buffer.h" -#include "ui/ozone/platform/drm/gpu/drm_device.h" #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" +#include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" #include "ui/ozone/public/native_pixmap.h" namespace { @@ -31,27 +28,6 @@ const gfx::Size kOverlaySize(kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2); const gfx::SizeF kDefaultModeSizeF(1.0, 1.0); -class MockScanoutBuffer : public ui::ScanoutBuffer { - public: - MockScanoutBuffer(const gfx::Size& size) : size_(size) {} - - // ScanoutBuffer: - uint32_t GetFramebufferId() const override { return 0; } - uint32_t GetHandle() const override { return 0; } - gfx::Size GetSize() const override { return size_; } - uint32_t GetFramebufferPixelFormat() const override { - return DRM_FORMAT_XRGB8888; - } - bool RequiresGlFinish() const override { return false; } - - private: - ~MockScanoutBuffer() override {} - - gfx::Size size_; - - DISALLOW_COPY_AND_ASSIGN(MockScanoutBuffer); -}; - } // namespace class HardwareDisplayControllerTest : public testing::Test { @@ -101,7 +77,7 @@ void HardwareDisplayControllerTest::PageFlipCallback(gfx::SwapResult result) { TEST_F(HardwareDisplayControllerTest, CheckModesettingResult) { ui::OverlayPlane plane(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane, kDefaultMode)); EXPECT_FALSE(plane.buffer->HasOneRef()); @@ -109,12 +85,12 @@ TEST_F(HardwareDisplayControllerTest, CheckModesettingResult) { TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane2); controller_->SchedulePageFlip( @@ -134,7 +110,7 @@ TEST_F(HardwareDisplayControllerTest, CheckStateIfModesetFails) { drm_->set_set_crtc_expectation(false); ui::OverlayPlane plane(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_FALSE(controller_->Modeset(plane, kDefaultMode)); } @@ -143,12 +119,12 @@ TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) { drm_->set_page_flip_expectation(false); ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane2); controller_->SchedulePageFlip( @@ -165,10 +141,10 @@ TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) { TEST_F(HardwareDisplayControllerTest, CheckOverlayPresent) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); ui::OverlayPlane plane2( - scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kOverlaySize)), 1, - gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kOverlaySize), + scoped_refptr<ui::ScanoutBuffer>(new ui::MockScanoutBuffer(kOverlaySize)), + 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kOverlaySize), gfx::RectF(kDefaultModeSizeF)); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); @@ -189,10 +165,10 @@ TEST_F(HardwareDisplayControllerTest, CheckOverlayPresent) { TEST_F(HardwareDisplayControllerTest, CheckOverlayTestMode) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); ui::OverlayPlane plane2( - scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kOverlaySize)), 1, - gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kOverlaySize), + scoped_refptr<ui::ScanoutBuffer>(new ui::MockScanoutBuffer(kOverlaySize)), + 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kOverlaySize), gfx::RectF(kDefaultModeSizeF)); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); @@ -226,11 +202,12 @@ TEST_F(HardwareDisplayControllerTest, CheckOverlayTestMode) { TEST_F(HardwareDisplayControllerTest, CheckOverlayFullScreenMode) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); - ui::OverlayPlane plane2( - scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)), - 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize), - gfx::RectF(kDefaultModeSizeF)); + new ui::MockScanoutBuffer(kDefaultModeSize))); + ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>( + new ui::MockScanoutBuffer(kDefaultModeSize)), + 1, gfx::OVERLAY_TRANSFORM_NONE, + gfx::Rect(kDefaultModeSize), + gfx::RectF(kDefaultModeSizeF)); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); @@ -250,11 +227,12 @@ TEST_F(HardwareDisplayControllerTest, CheckOverlayFullScreenMode) { TEST_F(HardwareDisplayControllerTest, RejectUnderlays) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); - ui::OverlayPlane plane2( - scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)), - -1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize), - gfx::RectF(kDefaultModeSizeF)); + new ui::MockScanoutBuffer(kDefaultModeSize))); + ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>( + new ui::MockScanoutBuffer(kDefaultModeSize)), + -1, gfx::OVERLAY_TRANSFORM_NONE, + gfx::Rect(kDefaultModeSize), + gfx::RectF(kDefaultModeSizeF)); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); @@ -274,12 +252,12 @@ TEST_F(HardwareDisplayControllerTest, PageflipMirroredControllers) { new ui::CrtcController(drm_.get(), kSecondaryCrtc, kSecondaryConnector))); ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); EXPECT_EQ(2, drm_->get_set_crtc_call_count()); ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane2); controller_->SchedulePageFlip( @@ -294,7 +272,7 @@ TEST_F(HardwareDisplayControllerTest, PageflipMirroredControllers) { TEST_F(HardwareDisplayControllerTest, PlaneStateAfterRemoveCrtc) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -333,7 +311,7 @@ TEST_F(HardwareDisplayControllerTest, PlaneStateAfterRemoveCrtc) { TEST_F(HardwareDisplayControllerTest, PlaneStateAfterDestroyingCrtc) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -364,7 +342,7 @@ TEST_F(HardwareDisplayControllerTest, PlaneStateAfterAddCrtc) { new ui::CrtcController(drm_.get(), kSecondaryCrtc, kSecondaryConnector))); ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -412,7 +390,7 @@ TEST_F(HardwareDisplayControllerTest, PlaneStateAfterAddCrtc) { TEST_F(HardwareDisplayControllerTest, ModesetWhilePageFlipping) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -430,7 +408,7 @@ TEST_F(HardwareDisplayControllerTest, FailPageFlipping) { drm_->set_page_flip_expectation(false); ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -444,10 +422,10 @@ TEST_F(HardwareDisplayControllerTest, FailPageFlipping) { } TEST_F(HardwareDisplayControllerTest, FailPageFlippingDueToNoPrimaryPlane) { - ui::OverlayPlane plane1( - scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)), - 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize), - gfx::RectF(0, 0, 1, 1)); + ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( + new ui::MockScanoutBuffer(kDefaultModeSize)), + 1, gfx::OVERLAY_TRANSFORM_NONE, + gfx::Rect(kDefaultModeSize), gfx::RectF(0, 0, 1, 1)); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -462,7 +440,7 @@ TEST_F(HardwareDisplayControllerTest, FailPageFlippingDueToNoPrimaryPlane) { TEST_F(HardwareDisplayControllerTest, AddCrtcMidPageFlip) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); @@ -480,7 +458,7 @@ TEST_F(HardwareDisplayControllerTest, AddCrtcMidPageFlip) { TEST_F(HardwareDisplayControllerTest, RemoveCrtcMidPageFlip) { ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( - new MockScanoutBuffer(kDefaultModeSize))); + new ui::MockScanoutBuffer(kDefaultModeSize))); EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); std::vector<ui::OverlayPlane> planes = std::vector<ui::OverlayPlane>(1, plane1); diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h index bd15354..d1817c7 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h @@ -20,7 +20,7 @@ class OZONE_EXPORT HardwareDisplayPlaneManagerLegacy bool Commit(HardwareDisplayPlaneList* plane_list, bool test_only) override; - private: + protected: bool SetPlaneData(HardwareDisplayPlaneList* plane_list, HardwareDisplayPlane* hw_plane, const OverlayPlane& overlay, @@ -28,6 +28,7 @@ class OZONE_EXPORT HardwareDisplayPlaneManagerLegacy const gfx::Rect& src_rect, CrtcController* crtc) override; + private: DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerLegacy); }; diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc index e29e47e..4ab2b7f 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc @@ -2,107 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <drm_fourcc.h> - -#include <utility> -#include <vector> - #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/ozone/platform/drm/gpu/crtc_controller.h" -#include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" -#include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" -#include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" -#include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" +#include "ui/ozone/platform/drm/gpu/fake_plane_info.h" #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" -#include "ui/ozone/platform/drm/gpu/overlay_plane.h" -#include "ui/ozone/platform/drm/gpu/scanout_buffer.h" +#include "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" +#include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" namespace { -struct FakePlaneInfo { - uint32_t id; - uint32_t allowed_crtc_mask; -}; - -const FakePlaneInfo kOnePlanePerCrtc[] = {{10, 1}, {20, 2}}; -const FakePlaneInfo kTwoPlanesPerCrtc[] = {{10, 1}, {11, 1}, {20, 2}, {21, 2}}; -const FakePlaneInfo kOnePlanePerCrtcWithShared[] = {{10, 1}, {20, 2}, {50, 3}}; +const ui::FakePlaneInfo kOnePlanePerCrtc[] = {{10, 1}, {20, 2}}; +const ui::FakePlaneInfo kTwoPlanesPerCrtc[] = {{10, 1}, + {11, 1}, + {20, 2}, + {21, 2}}; +const ui::FakePlaneInfo kOnePlanePerCrtcWithShared[] = {{10, 1}, + {20, 2}, + {50, 3}}; const uint32_t kDummyFormat = 0; - -class FakeScanoutBuffer : public ui::ScanoutBuffer { - public: - FakeScanoutBuffer(uint32_t format) - : format_(format), size_(gfx::Size(2, 2)) {} - - // ui::ScanoutBuffer: - uint32_t GetFramebufferId() const override { return 1; } - uint32_t GetHandle() const override { return 0; } - void SetSize(const gfx::Size& size) { size_ = size; } - gfx::Size GetSize() const override { return size_; } - void SetFramebufferPixelFormat(uint32_t format) { format_ = format; } - uint32_t GetFramebufferPixelFormat() const override { return format_; } - bool RequiresGlFinish() const override { return false; } - - protected: - ~FakeScanoutBuffer() override {} - uint32_t format_; - gfx::Size size_; -}; - -class FakePlaneManager : public ui::HardwareDisplayPlaneManager { - public: - FakePlaneManager() : plane_count_(0) {} - ~FakePlaneManager() override {} - - // Normally we'd use DRM to figure out the controller configuration. But we - // can't use DRM in unit tests, so we just create a fake configuration. - void InitForTest(const FakePlaneInfo* planes, - size_t count, - const std::vector<uint32_t>& crtcs) { - crtcs_ = crtcs; - for (size_t i = 0; i < count; i++) { - scoped_ptr<ui::HardwareDisplayPlane> plane(new ui::HardwareDisplayPlane( - planes[i].id, planes[i].allowed_crtc_mask)); - // Add support to test more formats. - plane->Initialize(drm_, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), - false, true); - planes_.push_back(std::move(plane)); - } - // The real HDPM uses sorted planes, so sort them for consistency. - std::sort(planes_.begin(), planes_.end(), - [](const scoped_ptr<ui::HardwareDisplayPlane>& l, - const scoped_ptr<ui::HardwareDisplayPlane>& r) { - return l->plane_id() < r->plane_id(); - }); - } - - bool Commit(ui::HardwareDisplayPlaneList* plane_list, - bool test_only) override { - return false; - } - - bool SetPlaneData(ui::HardwareDisplayPlaneList* plane_list, - ui::HardwareDisplayPlane* hw_plane, - const ui::OverlayPlane& overlay, - uint32_t crtc_id, - const gfx::Rect& src_rect, - ui::CrtcController* crtc) override { - // Check that the chosen plane is a legal choice for the crtc. - EXPECT_NE(-1, LookupCrtcIndex(crtc_id)); - EXPECT_TRUE(hw_plane->CanUseForCrtc(LookupCrtcIndex(crtc_id))); - EXPECT_FALSE(hw_plane->in_use()); - plane_count_++; - return true; - } - - int plane_count() const { return plane_count_; } - - private: - DISALLOW_COPY_AND_ASSIGN(FakePlaneManager); - - int plane_count_; -}; +const gfx::Size kDefaultBufferSize(2, 2); class HardwareDisplayPlaneManagerTest : public testing::Test { public: @@ -111,20 +30,24 @@ class HardwareDisplayPlaneManagerTest : public testing::Test { void SetUp() override; protected: - scoped_ptr<FakePlaneManager> plane_manager_; + scoped_ptr<ui::MockHardwareDisplayPlaneManager> plane_manager_; ui::HardwareDisplayPlaneList state_; std::vector<uint32_t> default_crtcs_; scoped_refptr<ui::ScanoutBuffer> fake_buffer_; + scoped_refptr<ui::MockDrmDevice> fake_drm_; private: DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerTest); }; void HardwareDisplayPlaneManagerTest::SetUp() { - fake_buffer_ = new FakeScanoutBuffer(DRM_FORMAT_XRGB8888); - plane_manager_.reset(new FakePlaneManager()); + fake_buffer_ = new ui::MockScanoutBuffer(kDefaultBufferSize); default_crtcs_.push_back(100); default_crtcs_.push_back(200); + + fake_drm_ = new ui::MockDrmDevice(false, default_crtcs_, 2); + plane_manager_.reset( + new ui::MockHardwareDisplayPlaneManager(fake_drm_.get())); } TEST_F(HardwareDisplayPlaneManagerTest, SinglePlaneAssignment) { @@ -232,9 +155,8 @@ TEST_F(HardwareDisplayPlaneManagerTest, MultipleFramesDifferentPlanes) { TEST_F(HardwareDisplayPlaneManagerTest, SharedPlanes) { ui::OverlayPlaneList assigns; - scoped_refptr<FakeScanoutBuffer> buffer = - new FakeScanoutBuffer(DRM_FORMAT_XRGB8888); - buffer->SetSize(gfx::Size(1, 1)); + scoped_refptr<ui::MockScanoutBuffer> buffer = + new ui::MockScanoutBuffer(gfx::Size(1, 1)); assigns.push_back(ui::OverlayPlane(fake_buffer_)); assigns.push_back(ui::OverlayPlane(buffer)); @@ -252,7 +174,8 @@ TEST_F(HardwareDisplayPlaneManagerTest, SharedPlanes) { TEST_F(HardwareDisplayPlaneManagerTest, CheckFramebufferFormatMatch) { ui::OverlayPlaneList assigns; - scoped_refptr<FakeScanoutBuffer> buffer = new FakeScanoutBuffer(kDummyFormat); + scoped_refptr<ui::MockScanoutBuffer> buffer = + new ui::MockScanoutBuffer(kDefaultBufferSize, kDummyFormat); assigns.push_back(ui::OverlayPlane(buffer)); plane_manager_->InitForTest(kOnePlanePerCrtc, arraysize(kOnePlanePerCrtc), default_crtcs_); @@ -261,11 +184,13 @@ TEST_F(HardwareDisplayPlaneManagerTest, CheckFramebufferFormatMatch) { // DRM_FORMAT_XRGB8888 while buffer returns kDummyFormat as its pixelFormat. EXPECT_FALSE(plane_manager_->AssignOverlayPlanes(&state_, assigns, default_crtcs_[0], nullptr)); - buffer->SetFramebufferPixelFormat(DRM_FORMAT_XRGB8888); + assigns.clear(); + scoped_refptr<ui::MockScanoutBuffer> xrgb_buffer = + new ui::MockScanoutBuffer(kDefaultBufferSize); + assigns.push_back(ui::OverlayPlane(xrgb_buffer)); plane_manager_->BeginFrame(&state_); EXPECT_TRUE(plane_manager_->AssignOverlayPlanes(&state_, assigns, default_crtcs_[0], nullptr)); - buffer->SetFramebufferPixelFormat(DRM_FORMAT_ARGB8888); plane_manager_->BeginFrame(&state_); EXPECT_FALSE(plane_manager_->AssignOverlayPlanes(&state_, assigns, default_crtcs_[0], nullptr)); @@ -274,13 +199,13 @@ TEST_F(HardwareDisplayPlaneManagerTest, CheckFramebufferFormatMatch) { TEST(HardwareDisplayPlaneManagerLegacyTest, UnusedPlanesAreReleased) { std::vector<uint32_t> crtcs; crtcs.push_back(100); + scoped_refptr<ui::MockDrmDevice> drm = new ui::MockDrmDevice(false, crtcs, 2); ui::OverlayPlaneList assigns; - scoped_refptr<FakeScanoutBuffer> primary_buffer = - new FakeScanoutBuffer(DRM_FORMAT_XRGB8888); - scoped_refptr<FakeScanoutBuffer> overlay_buffer = - new FakeScanoutBuffer(DRM_FORMAT_XRGB8888); - overlay_buffer->SetSize(gfx::Size(1, 1)); + scoped_refptr<ui::MockScanoutBuffer> primary_buffer = + new ui::MockScanoutBuffer(kDefaultBufferSize); + scoped_refptr<ui::MockScanoutBuffer> overlay_buffer = + new ui::MockScanoutBuffer(gfx::Size(1, 1)); assigns.push_back(ui::OverlayPlane(primary_buffer)); assigns.push_back(ui::OverlayPlane(overlay_buffer)); ui::HardwareDisplayPlaneList hdpl; diff --git a/ui/ozone/platform/drm/gpu/mock_drm_device.cc b/ui/ozone/platform/drm/gpu/mock_drm_device.cc index 80ba401..8dd6af0 100644 --- a/ui/ozone/platform/drm/gpu/mock_drm_device.cc +++ b/ui/ozone/platform/drm/gpu/mock_drm_device.cc @@ -4,14 +4,12 @@ #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" -#include <drm_fourcc.h> #include <xf86drm.h> -#include <xf86drmMode.h> -#include <utility> #include "base/logging.h" +#include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkCanvas.h" -#include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" +#include "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" namespace ui { @@ -22,28 +20,6 @@ Object* DrmAllocator() { return static_cast<Object*>(drmMalloc(sizeof(Object))); } -class MockHardwareDisplayPlaneManager - : public HardwareDisplayPlaneManagerLegacy { - public: - MockHardwareDisplayPlaneManager(DrmDevice* drm, - std::vector<uint32_t> crtcs, - size_t planes_per_crtc) { - const int kPlaneBaseId = 50; - drm_ = drm; - crtcs_.swap(crtcs); - for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { - for (size_t i = 0; i < planes_per_crtc; i++) { - scoped_ptr<HardwareDisplayPlane> plane( - new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); - // Add support to test more formats. - plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), - false, true); - planes_.push_back(std::move(plane)); - } - } - } -}; - } // namespace MockDrmDevice::MockDrmDevice() diff --git a/ui/ozone/platform/drm/gpu/mock_drm_device.h b/ui/ozone/platform/drm/gpu/mock_drm_device.h index c492606..3681241 100644 --- a/ui/ozone/platform/drm/gpu/mock_drm_device.h +++ b/ui/ozone/platform/drm/gpu/mock_drm_device.h @@ -16,11 +16,8 @@ namespace ui { -class CrtcController; -struct GammaRampRGBEntry; - // The real DrmDevice makes actual DRM calls which we can't use in unit tests. -class MockDrmDevice : public ui::DrmDevice { +class MockDrmDevice : public DrmDevice { public: MockDrmDevice(); MockDrmDevice(bool use_sync_flips, diff --git a/ui/ozone/platform/drm/gpu/mock_buffer_generator.cc b/ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.cc index acf1238..da7bdb2 100644 --- a/ui/ozone/platform/drm/gpu/mock_buffer_generator.cc +++ b/ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.cc @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/ozone/platform/drm/gpu/mock_buffer_generator.h" +#include "ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.h" #include "ui/ozone/platform/drm/gpu/drm_buffer.h" namespace ui { -MockBufferGenerator::MockBufferGenerator() {} +MockDumbBufferGenerator::MockDumbBufferGenerator() {} -MockBufferGenerator::~MockBufferGenerator() {} +MockDumbBufferGenerator::~MockDumbBufferGenerator() {} -scoped_refptr<ScanoutBuffer> MockBufferGenerator::Create( +scoped_refptr<ScanoutBuffer> MockDumbBufferGenerator::Create( const scoped_refptr<DrmDevice>& drm, gfx::BufferFormat format, const gfx::Size& size) { diff --git a/ui/ozone/platform/drm/gpu/mock_buffer_generator.h b/ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.h index 161c3279..bfa2ede 100644 --- a/ui/ozone/platform/drm/gpu/mock_buffer_generator.h +++ b/ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_OZONE_PLATFORM_DRM_GPU_MOCK_BUFFER_GENERATOR_H_ -#define UI_OZONE_PLATFORM_DRM_GPU_MOCK_BUFFER_GENERATOR_H_ +#ifndef UI_OZONE_PLATFORM_DRM_GPU_MOCK_DUMB_BUFFER_GENERATOR_H_ +#define UI_OZONE_PLATFORM_DRM_GPU_MOCK_DUMB_BUFFER_GENERATOR_H_ #include "base/macros.h" @@ -11,10 +11,10 @@ namespace ui { -class MockBufferGenerator : public ScanoutBufferGenerator { +class MockDumbBufferGenerator : public ScanoutBufferGenerator { public: - MockBufferGenerator(); - ~MockBufferGenerator() override; + MockDumbBufferGenerator(); + ~MockDumbBufferGenerator() override; // ScanoutBufferGenerator: scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DrmDevice>& drm, @@ -22,9 +22,9 @@ class MockBufferGenerator : public ScanoutBufferGenerator { const gfx::Size& size) override; private: - DISALLOW_COPY_AND_ASSIGN(MockBufferGenerator); + DISALLOW_COPY_AND_ASSIGN(MockDumbBufferGenerator); }; } // namespace ui -#endif // UI_OZONE_PLATFORM_DRM_GPU_MOCK_BUFFER_GENERATOR_H_ +#endif // UI_OZONE_PLATFORM_DRM_GPU_MOCK_DUMB_BUFFER_GENERATOR_H_ diff --git a/ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.cc b/ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.cc new file mode 100644 index 0000000..8868372 --- /dev/null +++ b/ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.cc @@ -0,0 +1,86 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" + +#include <drm_fourcc.h> +#include <utility> + +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/ozone/platform/drm/gpu/fake_plane_info.h" +#include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" + +namespace ui { + +MockHardwareDisplayPlaneManager::MockHardwareDisplayPlaneManager( + DrmDevice* drm, + const std::vector<uint32_t>& crtcs, + uint32_t planes_per_crtc) { + const int kPlaneBaseId = 50; + drm_ = drm; + crtcs_ = crtcs; + for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { + for (size_t i = 0; i < planes_per_crtc; i++) { + scoped_ptr<HardwareDisplayPlane> plane( + new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); + plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), + false, true); + planes_.push_back(std::move(plane)); + } + } + + // The real HDPM uses sorted planes, so sort them for consistency. + std::sort(planes_.begin(), planes_.end(), + [](const scoped_ptr<HardwareDisplayPlane>& l, + const scoped_ptr<HardwareDisplayPlane>& r) { + return l->plane_id() < r->plane_id(); + }); +} + +MockHardwareDisplayPlaneManager::MockHardwareDisplayPlaneManager( + DrmDevice* drm) { + drm_ = drm; +} + +void MockHardwareDisplayPlaneManager::InitForTest( + const FakePlaneInfo* planes, + size_t count, + const std::vector<uint32_t>& crtcs) { + crtcs_ = crtcs; + planes_.clear(); + for (size_t i = 0; i < count; i++) { + scoped_ptr<HardwareDisplayPlane> plane( + new HardwareDisplayPlane(planes[i].id, planes[i].allowed_crtc_mask)); + plane->Initialize(drm_, planes[i].allowed_formats, false, true); + planes_.push_back(std::move(plane)); + } + // The real HDPM uses sorted planes, so sort them for consistency. + std::sort(planes_.begin(), planes_.end(), + [](const scoped_ptr<HardwareDisplayPlane>& l, + const scoped_ptr<HardwareDisplayPlane>& r) { + return l->plane_id() < r->plane_id(); + }); +} + +bool MockHardwareDisplayPlaneManager::SetPlaneData( + HardwareDisplayPlaneList* plane_list, + HardwareDisplayPlane* hw_plane, + const OverlayPlane& overlay, + uint32_t crtc_id, + const gfx::Rect& src_rect, + CrtcController* crtc) { + // Check that the chosen plane is a legal choice for the crtc. + EXPECT_NE(-1, LookupCrtcIndex(crtc_id)); + EXPECT_TRUE(hw_plane->CanUseForCrtc(LookupCrtcIndex(crtc_id))); + EXPECT_FALSE(hw_plane->in_use()); + plane_count_++; + return HardwareDisplayPlaneManagerLegacy::SetPlaneData( + plane_list, hw_plane, overlay, crtc_id, src_rect, crtc); +} + +int MockHardwareDisplayPlaneManager::plane_count() const { + return plane_count_; +} + +} // namespace ui diff --git a/ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h b/ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h new file mode 100644 index 0000000..317038d --- /dev/null +++ b/ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h @@ -0,0 +1,43 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_DRM_GPU_MOCK_HARDWARE_DISPLAY_PLANE_MANAGER_H_ +#define UI_OZONE_PLATFORM_DRM_GPU_MOCK_HARDWARE_DISPLAY_PLANE_MANAGER_H_ + +#include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" + +namespace ui { +struct FakePlaneInfo; + +class MockHardwareDisplayPlaneManager + : public HardwareDisplayPlaneManagerLegacy { + public: + MockHardwareDisplayPlaneManager(DrmDevice* drm, + const std::vector<uint32_t>& crtcs, + uint32_t planes_per_crtc); + + explicit MockHardwareDisplayPlaneManager(DrmDevice* drm); + + // Normally we'd use DRM to figure out the controller configuration. But we + // can't use DRM in unit tests, so we just create a fake configuration. + void InitForTest(const FakePlaneInfo* planes, + size_t count, + const std::vector<uint32_t>& crtcs); + + bool SetPlaneData(HardwareDisplayPlaneList* plane_list, + HardwareDisplayPlane* hw_plane, + const OverlayPlane& overlay, + uint32_t crtc_id, + const gfx::Rect& src_rect, + CrtcController* crtc) override; + + int plane_count() const; + + private: + int plane_count_ = 0; +}; + +} // namespace ui + +#endif // UI_OZONE_PLATFORM_DRM_GPU_MOCK_HARDWARE_DISPLAY_PLANE_MANAGER_H_ diff --git a/ui/ozone/platform/drm/gpu/mock_scanout_buffer.cc b/ui/ozone/platform/drm/gpu/mock_scanout_buffer.cc new file mode 100644 index 0000000..60fbf5d --- /dev/null +++ b/ui/ozone/platform/drm/gpu/mock_scanout_buffer.cc @@ -0,0 +1,34 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" + +namespace ui { + +MockScanoutBuffer::MockScanoutBuffer(const gfx::Size& size, uint32_t format) + : size_(size), format_(format) {} + +MockScanoutBuffer::~MockScanoutBuffer() {} + +uint32_t MockScanoutBuffer::GetFramebufferId() const { + return 1; +} + +uint32_t MockScanoutBuffer::GetHandle() const { + return 0; +} + +gfx::Size MockScanoutBuffer::GetSize() const { + return size_; +} + +uint32_t MockScanoutBuffer::GetFramebufferPixelFormat() const { + return format_; +} + +bool MockScanoutBuffer::RequiresGlFinish() const { + return false; +} + +} // namespace ui diff --git a/ui/ozone/platform/drm/gpu/mock_scanout_buffer.h b/ui/ozone/platform/drm/gpu/mock_scanout_buffer.h new file mode 100644 index 0000000..d1b4f0f --- /dev/null +++ b/ui/ozone/platform/drm/gpu/mock_scanout_buffer.h @@ -0,0 +1,37 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_DRM_GPU_MOCK_SCANOUT_BUFFER_H_ +#define UI_OZONE_PLATFORM_DRM_GPU_MOCK_SCANOUT_BUFFER_H_ + +#include <drm_fourcc.h> + +#include "ui/ozone/platform/drm/gpu/scanout_buffer.h" + +namespace ui { + +class MockScanoutBuffer : public ScanoutBuffer { + public: + MockScanoutBuffer(const gfx::Size& size, + uint32_t format = DRM_FORMAT_XRGB8888); + + // ScanoutBuffer: + uint32_t GetFramebufferId() const override; + uint32_t GetHandle() const override; + gfx::Size GetSize() const override; + uint32_t GetFramebufferPixelFormat() const override; + bool RequiresGlFinish() const override; + + private: + ~MockScanoutBuffer() override; + + gfx::Size size_; + uint32_t format_; + + DISALLOW_COPY_AND_ASSIGN(MockScanoutBuffer); +}; + +} // namespace ui + +#endif // UI_OZONE_PLATFORM_DRM_GPU_MOCK_SCANOUT_BUFFER_H_ diff --git a/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc b/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc index e50fc51..709b6ce 100644 --- a/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc +++ b/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc @@ -10,8 +10,8 @@ #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" #include "ui/ozone/platform/drm/gpu/drm_window.h" #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" -#include "ui/ozone/platform/drm/gpu/mock_buffer_generator.h" #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" +#include "ui/ozone/platform/drm/gpu/mock_dumb_buffer_generator.h" #include "ui/ozone/platform/drm/gpu/screen_manager.h" namespace { @@ -48,7 +48,7 @@ class ScreenManagerTest : public testing::Test { void SetUp() override { drm_ = new ui::MockDrmDevice(); device_manager_.reset(new ui::DrmDeviceManager(nullptr)); - buffer_generator_.reset(new ui::MockBufferGenerator()); + buffer_generator_.reset(new ui::MockDumbBufferGenerator()); screen_manager_.reset(new ui::ScreenManager(buffer_generator_.get())); } void TearDown() override { @@ -59,7 +59,7 @@ class ScreenManagerTest : public testing::Test { protected: scoped_refptr<ui::MockDrmDevice> drm_; scoped_ptr<ui::DrmDeviceManager> device_manager_; - scoped_ptr<ui::MockBufferGenerator> buffer_generator_; + scoped_ptr<ui::MockDumbBufferGenerator> buffer_generator_; scoped_ptr<ui::ScreenManager> screen_manager_; private: |