| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/wm/core/nested_accelerator_controller.h" | 5 #include "ui/wm/core/nested_accelerator_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/event_types.h" | 8 #include "base/event_types.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 int num_key_events_dispatched() { return num_key_events_dispatched_; } | 39 int num_key_events_dispatched() { return num_key_events_dispatched_; } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 // ui::PlatformEventDispatcher: | 42 // ui::PlatformEventDispatcher: |
| 43 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override { | 43 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override { |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override { | 46 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override { |
| 47 if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED) | 47 if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED) |
| 48 num_key_events_dispatched_++; | 48 num_key_events_dispatched_++; |
| 49 return ui::POST_DISPATCH_NONE; | 49 return ui::kPostDispatchNone; |
| 50 } | 50 } |
| 51 | 51 |
| 52 int num_key_events_dispatched_; | 52 int num_key_events_dispatched_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); | 54 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class TestTarget : public ui::AcceleratorTarget { | 57 class TestTarget : public ui::AcceleratorTarget { |
| 58 public: | 58 public: |
| 59 TestTarget() : accelerator_pressed_count_(0) {} | 59 TestTarget() : accelerator_pressed_count_(0) {} |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 &inner_dispatcher); | 198 &inner_dispatcher); |
| 199 aura::client::DispatcherRunLoop run_loop( | 199 aura::client::DispatcherRunLoop run_loop( |
| 200 aura::client::GetDispatcherClient(root_window()), NULL); | 200 aura::client::GetDispatcherClient(root_window()), NULL); |
| 201 run_loop.Run(); | 201 run_loop.Run(); |
| 202 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); | 202 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); |
| 203 EXPECT_EQ(1, target.accelerator_pressed_count()); | 203 EXPECT_EQ(1, target.accelerator_pressed_count()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace test | 206 } // namespace test |
| 207 } // namespace wm | 207 } // namespace wm |
| OLD | NEW |