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

Side by Side Diff: ui/events/event_rewriter_unittest.cc

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build issues. Created 3 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 unified diff | Download patch
« no previous file with comments | « ui/events/event_rewriter.h ('k') | ui/events/event_sink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/events/event_rewriter.h" 5 #include "ui/events/event_rewriter.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 private: 56 private:
57 std::list<EventType> expected_events_; 57 std::list<EventType> expected_events_;
58 DISALLOW_COPY_AND_ASSIGN(TestEventRewriteProcessor); 58 DISALLOW_COPY_AND_ASSIGN(TestEventRewriteProcessor);
59 }; 59 };
60 60
61 // Trivial EventSource that does nothing but send events. 61 // Trivial EventSource that does nothing but send events.
62 class TestEventRewriteSource : public EventSource { 62 class TestEventRewriteSource : public EventSource {
63 public: 63 public:
64 explicit TestEventRewriteSource(EventProcessor* processor) 64 explicit TestEventRewriteSource(EventProcessor* processor)
65 : processor_(processor) {} 65 : processor_(processor) {}
66 EventProcessor* GetEventProcessor() override { return processor_; } 66 EventProcessor* GetEventSink() override { return processor_; }
67 void Send(EventType type) { 67 void Send(EventType type) {
68 std::unique_ptr<Event> event(new TestEvent(type)); 68 std::unique_ptr<Event> event(new TestEvent(type));
69 (void)SendEventToProcessor(event.get()); 69 SendEventToSink(event.get());
70 } 70 }
71 71
72 private: 72 private:
73 EventProcessor* processor_; 73 EventProcessor* processor_;
74 }; 74 };
75 75
76 // This EventRewriter always returns the same status, and if rewriting, the 76 // This EventRewriter always returns the same status, and if rewriting, the
77 // same event type; it is used to test simple rewriting, and rewriter addition, 77 // same event type; it is used to test simple rewriting, and rewriter addition,
78 // removal, and sequencing. Consequently EVENT_REWRITE_DISPATCH_ANOTHER is not 78 // removal, and sequencing. Consequently EVENT_REWRITE_DISPATCH_ANOTHER is not
79 // supported here (calls to NextDispatchEvent() would continue indefinitely). 79 // supported here (calls to NextDispatchEvent() would continue indefinitely).
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 s.RemoveEventRewriter(&r3); 223 s.RemoveEventRewriter(&r3);
224 224
225 // Continue with the state-based rewriting. 225 // Continue with the state-based rewriting.
226 p.AddExpectedEvent(ET_MOUSE_RELEASED); 226 p.AddExpectedEvent(ET_MOUSE_RELEASED);
227 p.AddExpectedEvent(ET_KEY_RELEASED); 227 p.AddExpectedEvent(ET_KEY_RELEASED);
228 s.Send(ET_MOUSE_RELEASED); 228 s.Send(ET_MOUSE_RELEASED);
229 p.CheckAllReceived(); 229 p.CheckAllReceived();
230 } 230 }
231 231
232 } // namespace ui 232 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event_rewriter.h ('k') | ui/events/event_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698