| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_ | 5 #ifndef REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_ |
| 6 #define REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_ | 6 #define REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <cmath> | 10 #include <cmath> |
| 9 | 11 |
| 10 #include "remoting/proto/event.pb.h" | 12 #include "remoting/proto/event.pb.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 12 | 14 |
| 13 // This file contains matchers for protocol events. | 15 // This file contains matchers for protocol events. |
| 14 namespace remoting { | 16 namespace remoting { |
| 15 namespace protocol { | 17 namespace protocol { |
| 16 namespace test { | 18 namespace test { |
| 17 | 19 |
| 18 MATCHER_P2(EqualsKeyEvent, usb_keycode, pressed, "") { | 20 MATCHER_P2(EqualsKeyEvent, usb_keycode, pressed, "") { |
| 19 return arg.usb_keycode() == static_cast<uint32>(usb_keycode) && | 21 return arg.usb_keycode() == static_cast<uint32_t>(usb_keycode) && |
| 20 arg.pressed() == pressed; | 22 arg.pressed() == pressed; |
| 21 } | 23 } |
| 22 | 24 |
| 23 MATCHER_P2(EqualsKeyEventWithCapsLock, usb_keycode, pressed, "") { | 25 MATCHER_P2(EqualsKeyEventWithCapsLock, usb_keycode, pressed, "") { |
| 24 return arg.usb_keycode() == static_cast<uint32>(usb_keycode) && | 26 return arg.usb_keycode() == static_cast<uint32_t>(usb_keycode) && |
| 25 arg.pressed() == pressed && | 27 arg.pressed() == pressed && |
| 26 arg.lock_states() == KeyEvent::LOCK_STATES_CAPSLOCK; | 28 arg.lock_states() == KeyEvent::LOCK_STATES_CAPSLOCK; |
| 27 } | 29 } |
| 28 | 30 |
| 29 MATCHER_P2(EqualsKeyEventWithNumLock, usb_keycode, pressed, "") { | 31 MATCHER_P2(EqualsKeyEventWithNumLock, usb_keycode, pressed, "") { |
| 30 return arg.usb_keycode() == static_cast<uint32>(usb_keycode) && | 32 return arg.usb_keycode() == static_cast<uint32_t>(usb_keycode) && |
| 31 arg.pressed() == pressed && | 33 arg.pressed() == pressed && |
| 32 arg.lock_states() == KeyEvent::LOCK_STATES_NUMLOCK; | 34 arg.lock_states() == KeyEvent::LOCK_STATES_NUMLOCK; |
| 33 } | 35 } |
| 34 | 36 |
| 35 MATCHER_P2(EqualsKeyEventWithoutLockStates, usb_keycode, pressed, "") { | 37 MATCHER_P2(EqualsKeyEventWithoutLockStates, usb_keycode, pressed, "") { |
| 36 return arg.usb_keycode() == static_cast<uint32>(usb_keycode) && | 38 return arg.usb_keycode() == static_cast<uint32_t>(usb_keycode) && |
| 37 arg.pressed() == pressed && | 39 arg.pressed() == pressed && !arg.has_lock_states(); |
| 38 !arg.has_lock_states(); | |
| 39 } | 40 } |
| 40 | 41 |
| 41 MATCHER_P(EqualsTextEvent, text, "") { | 42 MATCHER_P(EqualsTextEvent, text, "") { |
| 42 return arg.text() == text; | 43 return arg.text() == text; |
| 43 } | 44 } |
| 44 | 45 |
| 45 MATCHER_P2(EqualsMouseMoveEvent, x, y, "") { | 46 MATCHER_P2(EqualsMouseMoveEvent, x, y, "") { |
| 46 return arg.x() == x && arg.y() == y; | 47 return arg.x() == x && arg.y() == y; |
| 47 } | 48 } |
| 48 | 49 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return false; | 133 return false; |
| 133 | 134 |
| 134 return arg.touch_points(0).id() == id; | 135 return arg.touch_points(0).id() == id; |
| 135 } | 136 } |
| 136 | 137 |
| 137 } // namespace test | 138 } // namespace test |
| 138 } // namespace protocol | 139 } // namespace protocol |
| 139 } // namespace remoting | 140 } // namespace remoting |
| 140 | 141 |
| 141 #endif // REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_ | 142 #endif // REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_ |
| OLD | NEW |