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

Unified Diff: ash/accelerators/nested_dispatcher_controller_unittest.cc

Issue 9958152: Consolidate win/x dispatchers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 8 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/accelerators/nested_dispatcher_controller_unittest.cc
diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc
index 905b35391a01e5cbcb3549fabe43fff4818ec598..c24bd475634e9866418d5520f48b4a1bc198e72d 100644
--- a/ash/accelerators/nested_dispatcher_controller_unittest.cc
+++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc
@@ -15,6 +15,7 @@
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/base/accelerators/accelerator.h"
+#include "ui/base/events.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
@@ -33,21 +34,14 @@ class MockDispatcher : public MessageLoop::Dispatcher {
int num_key_events_dispatched() { return num_key_events_dispatched_; }
-#if defined(OS_WIN)
- virtual bool Dispatch(const MSG& msg) OVERRIDE {
- if (msg.message == WM_KEYUP)
+#if defined(OS_WIN) || defined(USE_X11)
+ virtual base::DispatchStatus Dispatch(
+ const base::NativeEvent& event) OVERRIDE {
+ if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED)
num_key_events_dispatched_++;
- return !ui::IsNoopEvent(msg);
+ return ui::IsNoopEvent(event) ? base::EVENT_QUIT : base::EVENT_PROCESSED;
}
-#elif defined(USE_X11)
- virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(
- XEvent* xev) OVERRIDE {
- if (xev->type == KeyRelease)
- num_key_events_dispatched_++;
- return ui::IsNoopEvent(xev) ? MessagePumpDispatcher::EVENT_QUIT :
- MessagePumpDispatcher::EVENT_IGNORED;
- }
-#endif
+#endif // defined(OS_WIN) || defined(USE_X11)
private:
int num_key_events_dispatched_;

Powered by Google App Engine
This is Rietveld 408576698