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

Unified Diff: ash/wm/window_manager_unittest.cc

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build issues. Created 3 years, 9 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: ash/wm/window_manager_unittest.cc
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 18697f24fab456675c26540ea7c530d43593c9ff..7d4936ca894bd2d20c79d66bb5727faff317f00c 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -18,7 +18,7 @@
#include "ui/base/hit_test.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
-#include "ui/events/event_processor.h"
+#include "ui/events/event_sink.h"
#include "ui/events/event_utils.h"
#include "ui/events/test/event_generator.h"
#include "ui/events/test/test_event_handler.h"
@@ -151,11 +151,11 @@ TEST_F(WindowManagerTest, Focus) {
aura::client::GetFocusClient(w121.get());
EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow());
- ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
+ ui::EventSink* sink = root_window->GetHost()->event_sink();
// The key press should be sent to the focused sub-window.
ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&keyev);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&keyev);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code());
@@ -165,14 +165,14 @@ TEST_F(WindowManagerTest, Focus) {
ui::TouchEvent touchev(
ui::ET_TOUCH_PRESSED, click_point, getTime(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
- details = dispatcher->OnEventFromSource(&touchev);
+ details = sink->OnEventFromSource(&touchev);
ASSERT_FALSE(details.dispatcher_destroyed);
focus_client = aura::client::GetFocusClient(w122.get());
EXPECT_EQ(w122.get(), focus_client->GetFocusedWindow());
// The key press should be sent to the focused sub-window.
keyev = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
- details = dispatcher->OnEventFromSource(&keyev);
+ details = sink->OnEventFromSource(&keyev);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::VKEY_E, w122delegate->last_key_code());
@@ -211,7 +211,7 @@ TEST_F(WindowManagerTest, Focus) {
aura::client::GetFocusClient(w123.get()));
EXPECT_EQ(NULL, aura::client::GetFocusClient(w12.get())->GetFocusedWindow());
keyev = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
- details = dispatcher->OnEventFromSource(&keyev);
+ details = sink->OnEventFromSource(&keyev);
EXPECT_FALSE(keyev.handled() || details.dispatcher_destroyed);
// Set the focus back to w123
@@ -227,7 +227,7 @@ TEST_F(WindowManagerTest, Focus) {
w12->RemoveChild(w123.get());
EXPECT_EQ(NULL, aura::client::GetFocusClient(w123.get()));
keyev = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
- details = dispatcher->OnEventFromSource(&keyev);
+ details = sink->OnEventFromSource(&keyev);
EXPECT_FALSE(keyev.handled() || details.dispatcher_destroyed);
// Must set to NULL since the activation delegate will be destroyed before
@@ -422,8 +422,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) {
ui::ET_TOUCH_PRESSED, press_point, getTime(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
- ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&touchev1);
+ ui::EventSink* sink = root_window->GetHost()->event_sink();
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&touchev1);
ASSERT_FALSE(details.dispatcher_destroyed);
// Window2 should have become active.
@@ -443,7 +443,7 @@ TEST_F(WindowManagerTest, ActivateOnTouch) {
ui::TouchEvent touchev2(
ui::ET_TOUCH_PRESSED, press_point, getTime(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
- details = dispatcher->OnEventFromSource(&touchev2);
+ details = sink->OnEventFromSource(&touchev2);
ASSERT_FALSE(details.dispatcher_destroyed);
// Window2 should still be active and focused.
@@ -489,7 +489,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
aura::Window::ConvertPointToTarget(window->parent(), root_window, &point2);
aura::WindowTreeHost* host = root_window->GetHost();
- ui::EventProcessor* dispatcher = host->event_processor();
+ ui::EventSink* sink = host->event_sink();
// Cursor starts as a pointer (set during Shell::Init()).
EXPECT_EQ(ui::kCursorPointer, host->last_cursor().native_type());
@@ -499,7 +499,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTBOTTOM);
ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorSouthResize, host->last_cursor().native_type());
}
@@ -508,7 +508,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTBOTTOMLEFT);
ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorSouthWestResize, host->last_cursor().native_type());
}
@@ -517,7 +517,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTBOTTOMRIGHT);
ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorSouthEastResize, host->last_cursor().native_type());
}
@@ -526,7 +526,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTLEFT);
ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorWestResize, host->last_cursor().native_type());
}
@@ -535,7 +535,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTRIGHT);
ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorEastResize, host->last_cursor().native_type());
}
@@ -544,7 +544,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTTOP);
ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNorthResize, host->last_cursor().native_type());
}
@@ -553,7 +553,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTTOPLEFT);
ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNorthWestResize, host->last_cursor().native_type());
}
@@ -562,7 +562,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTTOPRIGHT);
ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move2);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNorthEastResize, host->last_cursor().native_type());
}
@@ -572,7 +572,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
window_delegate.set_hittest_code(HTCLIENT);
ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1,
ui::EventTimeForNow(), 0, 0);
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move1);
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::kCursorNull, host->last_cursor().native_type());
}
@@ -605,14 +605,14 @@ TEST_F(WindowManagerTest, TransformActivate) {
ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, miss_point, miss_point,
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
- ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&mouseev1);
+ ui::EventSink* sink = root_window->GetHost()->event_sink();
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&mouseev1);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(NULL, aura::client::GetFocusClient(w1.get())->GetFocusedWindow());
ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, miss_point, miss_point,
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
- details = dispatcher->OnEventFromSource(&mouseup);
+ details = sink->OnEventFromSource(&mouseup);
ASSERT_FALSE(details.dispatcher_destroyed);
gfx::Point hit_point(5, 15);
@@ -620,7 +620,7 @@ TEST_F(WindowManagerTest, TransformActivate) {
ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, hit_point, hit_point,
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
- details = dispatcher->OnEventFromSource(&mouseev2);
+ details = sink->OnEventFromSource(&mouseev2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
EXPECT_EQ(w1.get(),
@@ -649,12 +649,12 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
// Dispatches mouse and keyboard events.
ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
- ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor();
- ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event);
+ ui::EventSink* sink = root_window->GetHost()->event_sink();
+ ui::EventDispatchDetails details = sink->OnEventFromSource(&key_event);
ASSERT_FALSE(details.dispatcher_destroyed);
ui::MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0),
gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
- details = dispatcher->OnEventFromSource(&mouse_pressed);
+ details = sink->OnEventFromSource(&mouse_pressed);
ASSERT_FALSE(details.dispatcher_destroyed);
// Both filters should get the events.
@@ -671,11 +671,11 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
f1->set_mouse_event_handling_result(ui::ER_CONSUMED);
// Dispatches events.
- details = dispatcher->OnEventFromSource(&key_event);
+ details = sink->OnEventFromSource(&key_event);
ASSERT_FALSE(details.dispatcher_destroyed);
ui::MouseEvent mouse_released(ui::ET_MOUSE_RELEASED, gfx::Point(0, 0),
gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
- details = dispatcher->OnEventFromSource(&mouse_released);
+ details = sink->OnEventFromSource(&mouse_released);
ASSERT_FALSE(details.dispatcher_destroyed);
// f1 should still get the events but f2 no longer gets them.
@@ -691,9 +691,9 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
env_filter->RemoveHandler(f1.get());
// Dispatches events.
- details = dispatcher->OnEventFromSource(&key_event);
+ details = sink->OnEventFromSource(&key_event);
ASSERT_FALSE(details.dispatcher_destroyed);
- details = dispatcher->OnEventFromSource(&mouse_pressed);
+ details = sink->OnEventFromSource(&mouse_pressed);
ASSERT_FALSE(details.dispatcher_destroyed);
// f1 should get no events since it's out and f2 should get them.
« no previous file with comments | « ash/host/ash_window_tree_host_x11.cc ('k') | chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698