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

Side by Side Diff: ui/wm/core/nested_accelerator_controller_unittest.cc

Issue 667823002: PlatformEventDispatcher::DispatchEvent() should return a PostDispatchAction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui_enums
Patch Set: Fix platform_event_source_unittest.cc Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc ('k') | ui/wm/core/nested_accelerator_dispatcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698