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 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 MockDispatcher() : num_key_events_dispatched_(0) {} | 37 MockDispatcher() : num_key_events_dispatched_(0) {} |
38 | 38 |
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 ui::PostDispatchAction DispatchEvent( |
| 47 const ui::PlatformEvent& event) override { |
47 if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED) | 48 if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED) |
48 num_key_events_dispatched_++; | 49 num_key_events_dispatched_++; |
49 return ui::POST_DISPATCH_NONE; | 50 return ui::POST_DISPATCH_NONE; |
50 } | 51 } |
51 | 52 |
52 int num_key_events_dispatched_; | 53 int num_key_events_dispatched_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); | 55 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); |
55 }; | 56 }; |
56 | 57 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 &inner_dispatcher); | 199 &inner_dispatcher); |
199 aura::client::DispatcherRunLoop run_loop( | 200 aura::client::DispatcherRunLoop run_loop( |
200 aura::client::GetDispatcherClient(root_window()), NULL); | 201 aura::client::GetDispatcherClient(root_window()), NULL); |
201 run_loop.Run(); | 202 run_loop.Run(); |
202 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); | 203 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); |
203 EXPECT_EQ(1, target.accelerator_pressed_count()); | 204 EXPECT_EQ(1, target.accelerator_pressed_count()); |
204 } | 205 } |
205 | 206 |
206 } // namespace test | 207 } // namespace test |
207 } // namespace wm | 208 } // namespace wm |
OLD | NEW |