Commit 2941af41 authored by dnicoara's avatar dnicoara Committed by Commit bot

[Ozone-Dri] Merge the DriWindowDelegate with the implementation

Simplify code by removing an interface only used in testing.

BUG=none

Review URL: https://codereview.chromium.org/981583005

Cr-Commit-Position: refs/heads/master@{#319160}
parent 88fe77f9
......@@ -45,9 +45,8 @@ source_set("dri_common") {
"dri_vsync_provider.h",
"dri_window.cc",
"dri_window.h",
"dri_window_delegate.cc",
"dri_window_delegate.h",
"dri_window_delegate_impl.cc",
"dri_window_delegate_impl.h",
"dri_window_delegate_manager.cc",
"dri_window_delegate_manager.h",
"dri_window_manager.cc",
......@@ -120,7 +119,7 @@ if (ozone_platform_dri) {
testonly = true
sources = [
"dri_surface_unittest.cc",
"dri_window_delegate_impl_unittest.cc",
"dri_window_delegate_unittest.cc",
"hardware_display_controller_unittest.cc",
"hardware_display_plane_manager_unittest.cc",
"screen_manager_unittest.cc",
......
......@@ -67,9 +67,8 @@
'dri_vsync_provider.h',
'dri_window.cc',
'dri_window.h',
'dri_window_delegate.cc',
'dri_window_delegate.h',
'dri_window_delegate_impl.cc',
'dri_window_delegate_impl.h',
'dri_window_delegate_manager.cc',
'dri_window_delegate_manager.h',
'dri_window_manager.cc',
......@@ -120,7 +119,7 @@
'direct_dependent_settings': {
'sources': [
'dri_surface_unittest.cc',
'dri_window_delegate_impl_unittest.cc',
'dri_window_delegate_unittest.cc',
'hardware_display_controller_unittest.cc',
'hardware_display_plane_manager_unittest.cc',
'screen_manager_unittest.cc',
......
......@@ -9,7 +9,7 @@
#include "ipc/ipc_message_macros.h"
#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
#include "ui/ozone/platform/dri/drm_device.h"
#include "ui/ozone/platform/dri/native_display_delegate_dri.h"
......@@ -229,7 +229,7 @@ bool DriGpuPlatformSupport::OnMessageReceived(const IPC::Message& message) {
void DriGpuPlatformSupport::OnCreateWindowDelegate(
gfx::AcceleratedWidget widget) {
scoped_ptr<DriWindowDelegate> delegate(
new DriWindowDelegateImpl(widget, drm_device_manager_, screen_manager_));
new DriWindowDelegate(widget, drm_device_manager_, screen_manager_));
delegate->Initialize();
window_manager_->AddWindowDelegate(widget, delegate.Pass());
}
......
......@@ -13,7 +13,7 @@
#include "ui/gfx/skia_util.h"
#include "ui/ozone/platform/dri/dri_buffer.h"
#include "ui/ozone/platform/dri/dri_vsync_provider.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/drm_device.h"
#include "ui/ozone/platform/dri/hardware_display_controller.h"
......
......@@ -9,7 +9,7 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/dri/dri_surface.h"
#include "ui/ozone/platform/dri/dri_util.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
#include "ui/ozone/platform/dri/hardware_display_controller.h"
#include "ui/ozone/public/surface_ozone_canvas.h"
......
......@@ -11,7 +11,9 @@
#include "ui/ozone/platform/dri/dri_buffer.h"
#include "ui/ozone/platform/dri/dri_surface.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/drm_device_manager.h"
#include "ui/ozone/platform/dri/hardware_display_controller.h"
#include "ui/ozone/platform/dri/screen_manager.h"
#include "ui/ozone/platform/dri/test/mock_drm_device.h"
namespace {
......@@ -20,43 +22,11 @@ namespace {
const drmModeModeInfo kDefaultMode =
{0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, {'\0'}};
const gfx::AcceleratedWidget kDefaultWidgetHandle = 1;
const uint32_t kDefaultCrtc = 1;
const uint32_t kDefaultConnector = 2;
const size_t kPlanesPerCrtc = 1;
class MockDriWindowDelegate : public ui::DriWindowDelegate {
public:
MockDriWindowDelegate(ui::DrmDevice* drm) {
controller_.reset(new ui::HardwareDisplayController(make_scoped_ptr(
new ui::CrtcController(drm, kDefaultCrtc, kDefaultConnector))));
scoped_refptr<ui::DriBuffer> buffer(new ui::DriBuffer(drm));
SkImageInfo info = SkImageInfo::MakeN32Premul(kDefaultMode.hdisplay,
kDefaultMode.vdisplay);
EXPECT_TRUE(buffer->Initialize(info, true));
EXPECT_TRUE(controller_->Modeset(ui::OverlayPlane(buffer), kDefaultMode));
}
~MockDriWindowDelegate() override {}
// DriWindowDelegate:
void Initialize() override {}
void Shutdown() override {}
gfx::AcceleratedWidget GetAcceleratedWidget() override { return 1; }
ui::HardwareDisplayController* GetController() override {
return controller_.get();
}
void OnBoundsChanged(const gfx::Rect& bounds) override {}
void SetCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) override {}
void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location) override {}
void MoveCursor(const gfx::Point& location) override {}
private:
scoped_ptr<ui::HardwareDisplayController> controller_;
DISALLOW_COPY_AND_ASSIGN(MockDriWindowDelegate);
};
const uint32_t kDefaultCursorSize = 64;
} // namespace
......@@ -70,7 +40,10 @@ class DriSurfaceTest : public testing::Test {
protected:
scoped_ptr<base::MessageLoop> message_loop_;
scoped_refptr<ui::MockDrmDevice> drm_;
scoped_ptr<MockDriWindowDelegate> window_delegate_;
scoped_ptr<ui::DriBufferGenerator> buffer_generator_;
scoped_ptr<ui::ScreenManager> screen_manager_;
scoped_ptr<ui::DrmDeviceManager> drm_device_manager_;
scoped_ptr<ui::DriWindowDelegate> window_delegate_;
scoped_ptr<ui::DriSurface> surface_;
private:
......@@ -82,7 +55,19 @@ void DriSurfaceTest::SetUp() {
std::vector<uint32_t> crtcs;
crtcs.push_back(kDefaultCrtc);
drm_ = new ui::MockDrmDevice(true, crtcs, kPlanesPerCrtc);
window_delegate_.reset(new MockDriWindowDelegate(drm_.get()));
buffer_generator_.reset(new ui::DriBufferGenerator());
screen_manager_.reset(new ui::ScreenManager(buffer_generator_.get()));
screen_manager_->AddDisplayController(drm_, kDefaultCrtc, kDefaultConnector);
screen_manager_->ConfigureDisplayController(
drm_, kDefaultCrtc, kDefaultConnector, gfx::Point(), kDefaultMode);
drm_device_manager_.reset(new ui::DrmDeviceManager(drm_));
window_delegate_.reset(new ui::DriWindowDelegate(
kDefaultWidgetHandle, drm_device_manager_.get(), screen_manager_.get()));
window_delegate_->Initialize();
window_delegate_->OnBoundsChanged(
gfx::Rect(gfx::Size(kDefaultMode.hdisplay, kDefaultMode.vdisplay)));
surface_.reset(new ui::DriSurface(window_delegate_.get()));
surface_->ResizeCanvas(gfx::Size(kDefaultMode.hdisplay,
kDefaultMode.vdisplay));
......@@ -90,7 +75,7 @@ void DriSurfaceTest::SetUp() {
void DriSurfaceTest::TearDown() {
surface_.reset();
window_delegate_.reset();
window_delegate_->Shutdown();
drm_ = nullptr;
message_loop_.reset();
}
......@@ -113,12 +98,22 @@ TEST_F(DriSurfaceTest, CheckSurfaceContents) {
gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2));
SkBitmap image;
// Buffer 0 is the buffer used in SetUp for modesetting and buffer 1 is the
// frontbuffer.
// Buffer 2 is the backbuffer we just painted in, so we want to make sure its
// contents are correct.
image.setInfo(drm_->buffers()[2]->getCanvas()->imageInfo());
EXPECT_TRUE(drm_->buffers()[2]->getCanvas()->readPixels(&image, 0, 0));
std::vector<skia::RefPtr<SkSurface>> framebuffers;
for (const auto& buffer : drm_->buffers()) {
// Skip cursor buffers.
if (buffer->width() == kDefaultCursorSize &&
buffer->height() == kDefaultCursorSize)
continue;
framebuffers.push_back(buffer);
}
// Buffer 0 is the modesetting buffer, buffer 1 is the frontbuffer and buffer
// 2 is the backbuffer.
EXPECT_EQ(3u, framebuffers.size());
image.setInfo(framebuffers[2]->getCanvas()->imageInfo());
EXPECT_TRUE(framebuffers[2]->getCanvas()->readPixels(&image, 0, 0));
EXPECT_EQ(kDefaultMode.hdisplay, image.width());
EXPECT_EQ(kDefaultMode.vdisplay, image.height());
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "base/trace_event/trace_event.h"
#include "third_party/skia/include/core/SkBitmap.h"
......@@ -42,10 +42,9 @@ void UpdateCursorImage(DriBuffer* cursor, const SkBitmap& image) {
} // namespace
DriWindowDelegateImpl::DriWindowDelegateImpl(
gfx::AcceleratedWidget widget,
DrmDeviceManager* device_manager,
ScreenManager* screen_manager)
DriWindowDelegate::DriWindowDelegate(gfx::AcceleratedWidget widget,
DrmDeviceManager* device_manager,
ScreenManager* screen_manager)
: widget_(widget),
device_manager_(device_manager),
screen_manager_(screen_manager),
......@@ -55,42 +54,42 @@ DriWindowDelegateImpl::DriWindowDelegateImpl(
cursor_frame_delay_ms_(0) {
}
DriWindowDelegateImpl::~DriWindowDelegateImpl() {
DriWindowDelegate::~DriWindowDelegate() {
}
void DriWindowDelegateImpl::Initialize() {
TRACE_EVENT1("dri", "DriWindowDelegateImpl::Initialize", "widget", widget_);
void DriWindowDelegate::Initialize() {
TRACE_EVENT1("dri", "DriWindowDelegate::Initialize", "widget", widget_);
device_manager_->UpdateDrmDevice(widget_, nullptr);
screen_manager_->AddObserver(this);
}
void DriWindowDelegateImpl::Shutdown() {
TRACE_EVENT1("dri", "DriWindowDelegateImpl::Shutdown", "widget", widget_);
void DriWindowDelegate::Shutdown() {
TRACE_EVENT1("dri", "DriWindowDelegate::Shutdown", "widget", widget_);
screen_manager_->RemoveObserver(this);
device_manager_->RemoveDrmDevice(widget_);
}
gfx::AcceleratedWidget DriWindowDelegateImpl::GetAcceleratedWidget() {
gfx::AcceleratedWidget DriWindowDelegate::GetAcceleratedWidget() {
return widget_;
}
HardwareDisplayController* DriWindowDelegateImpl::GetController() {
HardwareDisplayController* DriWindowDelegate::GetController() {
return controller_;
}
void DriWindowDelegateImpl::OnBoundsChanged(const gfx::Rect& bounds) {
TRACE_EVENT2("dri", "DriWindowDelegateImpl::OnBoundsChanged", "widget",
widget_, "bounds", bounds.ToString());
void DriWindowDelegate::OnBoundsChanged(const gfx::Rect& bounds) {
TRACE_EVENT2("dri", "DriWindowDelegate::OnBoundsChanged", "widget", widget_,
"bounds", bounds.ToString());
bounds_ = bounds;
controller_ = screen_manager_->GetDisplayController(bounds);
UpdateWidgetToDrmDeviceMapping();
UpdateCursorBuffers();
}
void DriWindowDelegateImpl::SetCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) {
void DriWindowDelegate::SetCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) {
cursor_bitmaps_ = bitmaps;
cursor_location_ = location;
cursor_frame_ = 0;
......@@ -100,12 +99,12 @@ void DriWindowDelegateImpl::SetCursor(const std::vector<SkBitmap>& bitmaps,
if (cursor_frame_delay_ms_)
cursor_timer_.Start(
FROM_HERE, base::TimeDelta::FromMilliseconds(cursor_frame_delay_ms_),
this, &DriWindowDelegateImpl::OnCursorAnimationTimeout);
this, &DriWindowDelegate::OnCursorAnimationTimeout);
ResetCursor(false);
}
void DriWindowDelegateImpl::SetCursorWithoutAnimations(
void DriWindowDelegate::SetCursorWithoutAnimations(
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location) {
cursor_bitmaps_ = bitmaps;
......@@ -115,14 +114,14 @@ void DriWindowDelegateImpl::SetCursorWithoutAnimations(
ResetCursor(false);
}
void DriWindowDelegateImpl::MoveCursor(const gfx::Point& location) {
void DriWindowDelegate::MoveCursor(const gfx::Point& location) {
cursor_location_ = location;
if (controller_)
controller_->MoveCursor(location);
}
void DriWindowDelegateImpl::OnDisplayChanged(
void DriWindowDelegate::OnDisplayChanged(
HardwareDisplayController* controller) {
DCHECK(controller);
......@@ -147,13 +146,13 @@ void DriWindowDelegateImpl::OnDisplayChanged(
UpdateCursorBuffers();
}
void DriWindowDelegateImpl::OnDisplayRemoved(
void DriWindowDelegate::OnDisplayRemoved(
HardwareDisplayController* controller) {
if (controller_ == controller)
controller_ = nullptr;
}
void DriWindowDelegateImpl::ResetCursor(bool bitmap_only) {
void DriWindowDelegate::ResetCursor(bool bitmap_only) {
if (!controller_)
return;
......@@ -173,14 +172,14 @@ void DriWindowDelegateImpl::ResetCursor(bool bitmap_only) {
}
}
void DriWindowDelegateImpl::OnCursorAnimationTimeout() {
void DriWindowDelegate::OnCursorAnimationTimeout() {
cursor_frame_++;
cursor_frame_ %= cursor_bitmaps_.size();
ResetCursor(true);
}
void DriWindowDelegateImpl::UpdateWidgetToDrmDeviceMapping() {
void DriWindowDelegate::UpdateWidgetToDrmDeviceMapping() {
scoped_refptr<DrmDevice> drm = nullptr;
if (controller_)
drm = controller_->GetAllocationDrmDevice();
......@@ -188,7 +187,7 @@ void DriWindowDelegateImpl::UpdateWidgetToDrmDeviceMapping() {
device_manager_->UpdateDrmDevice(widget_, drm);
}
void DriWindowDelegateImpl::UpdateCursorBuffers() {
void DriWindowDelegate::UpdateCursorBuffers() {
if (!controller_) {
for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) {
cursor_buffers_[i] = nullptr;
......
......@@ -7,7 +7,12 @@
#include <vector>
#include "base/timer/timer.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/ozone_export.h"
#include "ui/ozone/platform/dri/display_change_observer.h"
class SkBitmap;
......@@ -18,52 +23,93 @@ class Rect;
namespace ui {
class DriBuffer;
class DrmDeviceManager;
class HardwareDisplayController;
// Interface for the display-server half of a DriWindow.
//
// The main implementation of this lives in the process that owns the display
// connection (usually the GPU process) and associates a platform window
// (DriWindow) with a display. A window is associated with the display whose
// bounds contains the window bounds. If there's no suitable display, the window
// is disconnected and its contents will not be visible.
//
// In software mode, this is owned directly on DriWindow because the display
// controller object is in the same process.
//
// In accelerated mode, there's a proxy implementation and calls are forwarded
// to the real object in the GPU process via IPC.
class DriWindowDelegate {
class ScreenManager;
// A delegate of the platform window (DriWindow) on the GPU process. This is
// used to keep track of window state changes such that each platform window is
// correctly associated with a display.
// A window is associated with the display whose bounds contains the window
// bounds. If there's no suitable display, the window is disconnected and its
// contents will not be visible.
class OZONE_EXPORT DriWindowDelegate : public DisplayChangeObserver {
public:
virtual ~DriWindowDelegate() {}
DriWindowDelegate(gfx::AcceleratedWidget widget,
DrmDeviceManager* device_manager,
ScreenManager* screen_manager);
~DriWindowDelegate() override;
virtual void Initialize() = 0;
void Initialize();
virtual void Shutdown() = 0;
void Shutdown();
// Returns the accelerated widget associated with the delegate.
virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
gfx::AcceleratedWidget GetAcceleratedWidget();
// Returns the current controller the window is displaying on. Callers should
// not cache the result as the controller may change as the window is moved.
virtual HardwareDisplayController* GetController() = 0;
HardwareDisplayController* GetController();
// Called when the window is resized/moved.
virtual void OnBoundsChanged(const gfx::Rect& bounds) = 0;
void OnBoundsChanged(const gfx::Rect& bounds);
// Update the HW cursor bitmap & move to specified location. If
// the bitmap is empty, the cursor is hidden.
virtual void SetCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) = 0;
void SetCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms);
// Update the HW cursor bitmap & move to specified location. If
// the bitmap is empty, the cursor is hidden.
virtual void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location) = 0;
void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location);
// Move the HW cursor to the specified location.
virtual void MoveCursor(const gfx::Point& location) = 0;
void MoveCursor(const gfx::Point& location);
// DisplayChangeObserver:
void OnDisplayChanged(HardwareDisplayController* controller) override;
void OnDisplayRemoved(HardwareDisplayController* controller) override;
private:
// Draw the last set cursor & update the cursor plane.
void ResetCursor(bool bitmap_only);
// Draw next frame in an animated cursor.
void OnCursorAnimationTimeout();
void UpdateWidgetToDrmDeviceMapping();
// When |controller_| changes this is called to reallocate the cursor buffers
// since the allocation DRM device may have changed.
void UpdateCursorBuffers();
gfx::AcceleratedWidget widget_;
DrmDeviceManager* device_manager_; // Not owned.
ScreenManager* screen_manager_; // Not owned.
// The current bounds of the window.
gfx::Rect bounds_;
// The controller associated with the current window. This may be nullptr if
// the window isn't over an active display.
HardwareDisplayController* controller_;
base::RepeatingTimer<DriWindowDelegate> cursor_timer_;
scoped_refptr<DriBuffer> cursor_buffers_[2];
int cursor_frontbuffer_;
std::vector<SkBitmap> cursor_bitmaps_;
gfx::Point cursor_location_;
int cursor_frame_;
int cursor_frame_delay_ms_;
DISALLOW_COPY_AND_ASSIGN(DriWindowDelegate);
};
} // namespace ui
......
// Copyright 2014 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_DRI_DRI_WINDOW_DELEGATE_IMPL_H_
#define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_IMPL_H_
#include "base/timer/timer.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/ozone_export.h"
#include "ui/ozone/platform/dri/display_change_observer.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
namespace ui {
class DriBuffer;
class DrmDeviceManager;
class HardwareDisplayController;
class ScreenManager;
class OZONE_EXPORT DriWindowDelegateImpl : public DriWindowDelegate,
public DisplayChangeObserver {
public:
DriWindowDelegateImpl(gfx::AcceleratedWidget widget,
DrmDeviceManager* device_manager,
ScreenManager* screen_manager);
~DriWindowDelegateImpl() override;
// DriWindowDelegate:
void Initialize() override;
void Shutdown() override;
gfx::AcceleratedWidget GetAcceleratedWidget() override;
HardwareDisplayController* GetController() override;
void OnBoundsChanged(const gfx::Rect& bounds) override;
void SetCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) override;
void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location) override;
void MoveCursor(const gfx::Point& location) override;
// DisplayChangeObserver:
void OnDisplayChanged(HardwareDisplayController* controller) override;
void OnDisplayRemoved(HardwareDisplayController* controller) override;
private:
// Draw the last set cursor & update the cursor plane.
void ResetCursor(bool bitmap_only);
// Draw next frame in an animated cursor.
void OnCursorAnimationTimeout();
void UpdateWidgetToDrmDeviceMapping();
// When |controller_| changes this is called to reallocate the cursor buffers
// since the allocation DRM device may have changed.
void UpdateCursorBuffers();
gfx::AcceleratedWidget widget_;
DrmDeviceManager* device_manager_; // Not owned.
ScreenManager* screen_manager_; // Not owned.
// The current bounds of the window.
gfx::Rect bounds_;
// The controller associated with the current window. This may be nullptr if
// the window isn't over an active display.
HardwareDisplayController* controller_;
base::RepeatingTimer<DriWindowDelegateImpl> cursor_timer_;
scoped_refptr<DriBuffer> cursor_buffers_[2];
int cursor_frontbuffer_;
std::vector<SkBitmap> cursor_bitmaps_;
gfx::Point cursor_location_;
int cursor_frame_;
int cursor_frame_delay_ms_;
DISALLOW_COPY_AND_ASSIGN(DriWindowDelegateImpl);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_IMPL_H_
......@@ -13,7 +13,7 @@
#include "ui/ozone/platform/dri/dri_buffer.h"
#include "ui/ozone/platform/dri/dri_surface.h"
#include "ui/ozone/platform/dri/dri_surface_factory.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
#include "ui/ozone/platform/dri/drm_device_manager.h"
#include "ui/ozone/platform/dri/hardware_display_controller.h"
......@@ -47,9 +47,9 @@ std::vector<skia::RefPtr<SkSurface>> GetCursorBuffers(
} // namespace
class DriWindowDelegateImplTest : public testing::Test {
class DriWindowDelegateTest : public testing::Test {
public:
DriWindowDelegateImplTest() {}
DriWindowDelegateTest() {}
void SetUp() override;
void TearDown() override;
......@@ -63,10 +63,10 @@ class DriWindowDelegateImplTest : public testing::Test {
scoped_ptr<ui::DriWindowDelegateManager> window_delegate_manager_;
private:
DISALLOW_COPY_AND_ASSIGN(DriWindowDelegateImplTest);
DISALLOW_COPY_AND_ASSIGN(DriWindowDelegateTest);
};
void DriWindowDelegateImplTest::SetUp() {
void DriWindowDelegateTest::SetUp() {
message_loop_.reset(new base::MessageLoopForUI);
drm_ = new ui::MockDrmDevice();
buffer_generator_.reset(new ui::DriBufferGenerator());
......@@ -78,10 +78,8 @@ void DriWindowDelegateImplTest::SetUp() {
drm_device_manager_.reset(new ui::DrmDeviceManager(drm_));
window_delegate_manager_.reset(new ui::DriWindowDelegateManager());
scoped_ptr<ui::DriWindowDelegate> window_delegate(
new ui::DriWindowDelegateImpl(kDefaultWidgetHandle,
drm_device_manager_.get(),
screen_manager_.get()));
scoped_ptr<ui::DriWindowDelegate> window_delegate(new ui::DriWindowDelegate(
kDefaultWidgetHandle, drm_device_manager_.get(), screen_manager_.get()));
window_delegate->Initialize();
window_delegate->OnBoundsChanged(
gfx::Rect(gfx::Size(kDefaultMode.hdisplay, kDefaultMode.vdisplay)));
......@@ -89,14 +87,14 @@ void DriWindowDelegateImplTest::SetUp() {
window_delegate.Pass());
}
void DriWindowDelegateImplTest::TearDown() {
void DriWindowDelegateTest::TearDown() {
scoped_ptr<ui::DriWindowDelegate> delegate =
window_delegate_manager_->RemoveWindowDelegate(kDefaultWidgetHandle);
delegate->Shutdown();
message_loop_.reset();
}
TEST_F(DriWindowDelegateImplTest, SetCursorImage) {
TEST_F(DriWindowDelegateTest, SetCursorImage) {
SkBitmap image;
SkImageInfo info =
SkImageInfo::Make(6, 4, kN32_SkColorType, kPremul_SkAlphaType);
......@@ -128,7 +126,7 @@ TEST_F(DriWindowDelegateImplTest, SetCursorImage) {
}
}
TEST_F(DriWindowDelegateImplTest, CheckCursorSurfaceAfterChangingDevice) {
TEST_F(DriWindowDelegateTest, CheckCursorSurfaceAfterChangingDevice) {
// Add another device.
scoped_refptr<ui::MockDrmDevice> drm = new ui::MockDrmDevice();
screen_manager_->AddDisplayController(drm, kDefaultCrtc, kDefaultConnector);
......
......@@ -10,7 +10,7 @@
#include "base/files/file_path.h"
#include "third_party/khronos/EGL/egl.h"
#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
#include "ui/ozone/platform/dri/drm_device_manager.h"
#include "ui/ozone/platform/dri/gbm_buffer.h"
......
......@@ -19,7 +19,7 @@
#include "ui/ozone/platform/dri/dri_surface_factory.h"
#include "ui/ozone/platform/dri/dri_util.h"
#include "ui/ozone/platform/dri/dri_window.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
#include "ui/ozone/platform/dri/dri_window_manager.h"
#include "ui/ozone/platform/dri/drm_device.h"
......
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