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

Unified Diff: ui/aura/window_unittest.cc

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 11 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
« no previous file with comments | « ui/aura/window_tree_host_delegate.h ('k') | ui/events/event_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_unittest.cc
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 637f0e699d7e67f2422dfe1e64403b1047ef6fa7..20abbd7b4cc58dca8602b31976fdb76ef5c8bea9 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -830,7 +830,7 @@ TEST_F(WindowTest, CaptureTests) {
ui::TouchEvent touchev(
ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&touchev);
+ DispatchEventUsingWindowDispatcher(&touchev);
EXPECT_EQ(1, delegate.touch_event_count());
delegate.ResetCounts();
@@ -846,7 +846,7 @@ TEST_F(WindowTest, CaptureTests) {
ui::TouchEvent touchev2(
ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&touchev2);
+ DispatchEventUsingWindowDispatcher(&touchev2);
EXPECT_EQ(0, delegate.touch_event_count());
// Removing the capture window from parent should reset the capture window
@@ -869,7 +869,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
// Press on w1.
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate1.gesture_event_count());
delegate1.ResetCounts();
@@ -883,7 +883,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
// Events now go to w2.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_EQ(0, delegate1.gesture_event_count());
EXPECT_EQ(0, delegate1.touch_event_count());
EXPECT_EQ(0, delegate2.gesture_event_count());
@@ -891,14 +891,14 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_EQ(0, delegate1.gesture_event_count());
EXPECT_EQ(0, delegate2.gesture_event_count());
// A new press is captured by w2.
ui::TouchEvent press2(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_EQ(0, delegate1.gesture_event_count());
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate2.gesture_event_count());
@@ -920,7 +920,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate.gesture_event_count());
@@ -935,7 +935,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// On move We will get TOUCH_MOVED, GESTURE_TAP_CANCEL,
// GESTURE_SCROLL_START and GESTURE_SCROLL_UPDATE.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(3, delegate.gesture_event_count());
delegate.ResetCounts();
@@ -948,7 +948,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE.
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(1, delegate.gesture_event_count());
delegate.ResetCounts();
@@ -956,7 +956,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(2, delegate.gesture_event_count());
}
@@ -969,7 +969,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
scoped_ptr<Window> w1(CreateTestWindowWithDelegate(
&d1, 0, gfx::Rect(0, 0, 20, 20), root_window()));
ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&p1);
+ DispatchEventUsingWindowDispatcher(&p1);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(1, d1.touch_event_count());
EXPECT_EQ(2, d1.gesture_event_count());
@@ -980,7 +980,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
&d2, 0, gfx::Rect(40, 0, 40, 20), root_window()));
ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&p2);
+ DispatchEventUsingWindowDispatcher(&p2);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window.
@@ -1016,7 +1016,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
// Move touch id originally associated with |w2|. Since capture was transfered
// from 2 to 3 only |w3| should get the event.
ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&m3);
+ DispatchEventUsingWindowDispatcher(&m3);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
EXPECT_EQ(0, d2.touch_event_count());
@@ -1039,7 +1039,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
// And when we move the touch again, |w3| still gets the events.
ui::TouchEvent m4(ui::ET_TOUCH_MOVED, gfx::Point(120, 105), 1, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&m4);
+ DispatchEventUsingWindowDispatcher(&m4);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
EXPECT_EQ(0, d2.touch_event_count());
@@ -1204,7 +1204,7 @@ TEST_F(WindowTest, WindowTreeHostExit) {
ui::MouseEvent exit_event(
ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0, 0);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostMouseEvent(&exit_event);
+ DispatchEventUsingWindowDispatcher(&exit_event);
EXPECT_FALSE(d1.entered());
EXPECT_TRUE(d1.exited());
}
@@ -1563,7 +1563,7 @@ TEST_F(WindowTest, TransformGesture) {
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
}
« no previous file with comments | « ui/aura/window_tree_host_delegate.h ('k') | ui/events/event_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698