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/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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/events/test/test_event_processor.h" | 14 #include "ui/events/test/test_event_processor.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // To test the handling of |EventRewriter|s through |EventSource|, | 20 // To test the handling of |EventRewriter|s through |EventSource|, |
21 // we rewrite and test event types. | 21 // we rewrite and test event types. |
22 class TestEvent : public Event { | 22 class TestEvent : public Event { |
23 public: | 23 public: |
24 explicit TestEvent(EventType type) | 24 explicit TestEvent(EventType type) |
25 : Event(type, base::TimeDelta(), 0), unique_id_(next_unique_id_++) {} | 25 : Event(type, base::TimeTicks(), 0), unique_id_(next_unique_id_++) {} |
26 ~TestEvent() override {} | 26 ~TestEvent() override {} |
27 int unique_id() const { return unique_id_; } | 27 int unique_id() const { return unique_id_; } |
28 | 28 |
29 private: | 29 private: |
30 static int next_unique_id_; | 30 static int next_unique_id_; |
31 int unique_id_; | 31 int unique_id_; |
32 }; | 32 }; |
33 | 33 |
34 int TestEvent::next_unique_id_ = 0; | 34 int TestEvent::next_unique_id_ = 0; |
35 | 35 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |