Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: components/exo/pointer_unittest.cc

Issue 2396883003: exo: Fix dragging edge cases (Closed)
Patch Set: Fix unit tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/exo/pointer_unittest.cc
diff --git a/components/exo/pointer_unittest.cc b/components/exo/pointer_unittest.cc
index 89a9b50a45f3c43e2963f60a14f315b869426a64..696d07435352c3bd16afbfaa4b2430af281e08c9 100644
--- a/components/exo/pointer_unittest.cc
+++ b/components/exo/pointer_unittest.cc
@@ -8,6 +8,7 @@
#include "ash/common/wm_shell.h"
#include "ash/shell.h"
#include "components/exo/buffer.h"
+#include "components/exo/display.h"
#include "components/exo/pointer.h"
#include "components/exo/pointer_delegate.h"
#include "components/exo/shell_surface.h"
@@ -42,8 +43,10 @@ class MockPointerDelegate : public PointerDelegate {
};
TEST_F(PointerTest, SetCursor) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -80,8 +83,10 @@ TEST_F(PointerTest, SetCursor) {
}
TEST_F(PointerTest, OnPointerEnter) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -103,8 +108,10 @@ TEST_F(PointerTest, OnPointerEnter) {
}
TEST_F(PointerTest, OnPointerLeave) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -129,8 +136,10 @@ TEST_F(PointerTest, OnPointerLeave) {
}
TEST_F(PointerTest, OnPointerMotion) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -175,8 +184,8 @@ TEST_F(PointerTest, OnPointerMotion) {
std::unique_ptr<Surface> child_surface(new Surface);
std::unique_ptr<ShellSurface> child_shell_surface(new ShellSurface(
- child_surface.get(), shell_surface.get(), gfx::Rect(9, 9, 1, 1), true,
- ash::kShellWindowId_DefaultContainer));
+ display, child_surface.get(), shell_surface.get(), gfx::Rect(9, 9, 1, 1),
+ true, ash::kShellWindowId_DefaultContainer));
gfx::Size child_buffer_size(15, 15);
std::unique_ptr<Buffer> child_buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(child_buffer_size)));
@@ -199,8 +208,10 @@ TEST_F(PointerTest, OnPointerMotion) {
}
TEST_F(PointerTest, OnPointerButton) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -229,8 +240,10 @@ TEST_F(PointerTest, OnPointerButton) {
}
TEST_F(PointerTest, OnPointerScroll) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -265,8 +278,10 @@ TEST_F(PointerTest, OnPointerScroll) {
}
TEST_F(PointerTest, OnPointerScrollDiscrete) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
@@ -293,8 +308,10 @@ TEST_F(PointerTest, OnPointerScrollDiscrete) {
}
TEST_F(PointerTest, IgnorePointerEventDuringModal) {
+ const Display display;
std::unique_ptr<Surface> surface(new Surface);
- std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
+ std::unique_ptr<ShellSurface> shell_surface(
+ new ShellSurface(display, surface.get()));
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(10, 10))));
surface->Attach(buffer.get());
@@ -308,8 +325,8 @@ TEST_F(PointerTest, IgnorePointerEventDuringModal) {
// Create surface for modal window.
std::unique_ptr<Surface> surface2(new Surface);
std::unique_ptr<ShellSurface> shell_surface2(
- new ShellSurface(surface2.get(), nullptr, gfx::Rect(0, 0, 5, 5), true,
- ash::kShellWindowId_SystemModalContainer));
+ new ShellSurface(display, surface2.get(), nullptr, gfx::Rect(0, 0, 5, 5),
+ true, ash::kShellWindowId_SystemModalContainer));
std::unique_ptr<Buffer> buffer2(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5))));
surface2->Attach(buffer2.get());

Powered by Google App Engine
This is Rietveld 408576698