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

Unified Diff: components/exo/touch_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/touch_unittest.cc
diff --git a/components/exo/touch_unittest.cc b/components/exo/touch_unittest.cc
index a1fd44180ed5cb828e44050fe9e12f9fc1f97339..ee76757e6a9238f0c7348dfc9ac95b698a86a112 100644
--- a/components/exo/touch_unittest.cc
+++ b/components/exo/touch_unittest.cc
@@ -9,6 +9,7 @@
#include "ash/common/wm_shell.h"
#include "ash/shell.h"
#include "components/exo/buffer.h"
+#include "components/exo/display.h"
#include "components/exo/shell_surface.h"
#include "components/exo/surface.h"
#include "components/exo/test/exo_test_base.h"
@@ -42,9 +43,10 @@ class MockTouchDelegate : public TouchDelegate {
TEST_F(TouchTest, OnTouchDown) {
ash::WindowPositioner::DisableAutoPositioning(true);
+ const Display display;
std::unique_ptr<Surface> bottom_surface(new Surface);
std::unique_ptr<ShellSurface> bottom_shell_surface(
- new ShellSurface(bottom_surface.get()));
+ new ShellSurface(display, bottom_surface.get()));
gfx::Size bottom_buffer_size(10, 10);
std::unique_ptr<Buffer> bottom_buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(bottom_buffer_size)));
@@ -55,7 +57,7 @@ TEST_F(TouchTest, OnTouchDown) {
std::unique_ptr<Surface> top_surface(new Surface);
std::unique_ptr<ShellSurface> top_shell_surface(
- new ShellSurface(top_surface.get()));
+ new ShellSurface(display, top_surface.get()));
gfx::Size top_buffer_size(8, 8);
std::unique_ptr<Buffer> top_buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(top_buffer_size)));
@@ -90,8 +92,10 @@ TEST_F(TouchTest, OnTouchDown) {
}
TEST_F(TouchTest, OnTouchUp) {
+ 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)));
@@ -122,8 +126,10 @@ TEST_F(TouchTest, OnTouchUp) {
}
TEST_F(TouchTest, OnTouchMotion) {
+ 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)));
@@ -161,8 +167,10 @@ TEST_F(TouchTest, OnTouchMotion) {
}
TEST_F(TouchTest, OnTouchCancel) {
+ 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)));
@@ -194,8 +202,10 @@ TEST_F(TouchTest, OnTouchCancel) {
}
TEST_F(TouchTest, IgnoreTouchEventDuringModal) {
+ 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());
@@ -209,8 +219,8 @@ TEST_F(TouchTest, IgnoreTouchEventDuringModal) {
// 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