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

Unified Diff: ash/accelerators/nested_dispatcher_controller_unittest.cc

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 Created 6 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
« no previous file with comments | « ash/accelerators/nested_dispatcher_controller.cc ('k') | ash/ash.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cc0a3525d0dc451f30eafd9bc21eb5e5505f7d19..20e399c4a0a0f7db009f546dc42fd925ff9fb667 100644
--- a/ash/accelerators/nested_dispatcher_controller_unittest.cc
+++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc
@@ -16,6 +16,9 @@
#include "ui/base/accelerators/accelerator.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_utils.h"
+#include "ui/events/platform/platform_event_dispatcher.h"
+#include "ui/events/platform/platform_event_source.h"
+#include "ui/events/platform/scoped_event_dispatcher.h"
#include "ui/wm/public/dispatcher_client.h"
#if defined(USE_X11)
@@ -28,21 +31,27 @@ namespace test {
namespace {
-class MockDispatcher : public base::MessagePumpDispatcher {
+class MockDispatcher : public ui::PlatformEventDispatcher {
public:
MockDispatcher() : num_key_events_dispatched_(0) {
}
int num_key_events_dispatched() { return num_key_events_dispatched_; }
- virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE {
+ private:
+ // ui::PlatformEventDispatcher:
+ virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE {
+ return true;
+ }
+ virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE {
if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED)
num_key_events_dispatched_++;
- return POST_DISPATCH_NONE;
+ return ui::POST_DISPATCH_NONE;
}
- private:
int num_key_events_dispatched_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockDispatcher);
};
class TestTarget : public ui::AcceleratorTarget {
@@ -111,8 +120,10 @@ TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) {
DispatchKeyReleaseA();
aura::Window* root_window = ash::Shell::GetPrimaryRootWindow();
- aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
- &inner_dispatcher);
+ scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher =
+ ui::PlatformEventSource::GetInstance()->OverrideDispatcher(
+ &inner_dispatcher);
+ aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(NULL);
EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched());
}
@@ -128,8 +139,10 @@ TEST_F(NestedDispatcherTest, AcceleratorsHandled) {
&target);
DispatchKeyReleaseA();
- aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
- &inner_dispatcher);
+ scoped_ptr<ui::ScopedEventDispatcher> override_dispatcher =
+ ui::PlatformEventSource::GetInstance()->OverrideDispatcher(
+ &inner_dispatcher);
+ aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(NULL);
EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
EXPECT_EQ(1, target.accelerator_pressed_count());
}
« no previous file with comments | « ash/accelerators/nested_dispatcher_controller.cc ('k') | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698