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 #include "apps/moterm/key_util.h" | 5 #include "apps/moterm/key_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "mojo/services/input_events/public/interfaces/input_events.mojom.h" | 9 #include "mojo/services/input_events/interfaces/input_events.mojom.h" |
10 #include "mojo/services/input_events/public/interfaces/input_key_codes.mojom.h" | 10 #include "mojo/services/input_events/interfaces/input_key_codes.mojom.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // Makes a key event. Note that this cheats in a number of respects. | 15 // Makes a key event. Note that this cheats in a number of respects. |
16 // TODO(vtl): Add a |flags| argument when |GetInputSequenceForKeyPressedEvent()| | 16 // TODO(vtl): Add a |flags| argument when |GetInputSequenceForKeyPressedEvent()| |
17 // actually uses it. | 17 // actually uses it. |
18 mojo::EventPtr MakeKeyEvent(bool is_char, | 18 mojo::EventPtr MakeKeyEvent(bool is_char, |
19 char character, | 19 char character, |
20 mojo::KeyboardCode windows_key_code) { | 20 mojo::KeyboardCode windows_key_code) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 *MakeKeyEvent(true, 0, mojo::KeyboardCode::HOME), true)); | 90 *MakeKeyEvent(true, 0, mojo::KeyboardCode::HOME), true)); |
91 // As should the arroy keys. | 91 // As should the arroy keys. |
92 EXPECT_EQ("\x1bOC", | 92 EXPECT_EQ("\x1bOC", |
93 GetInputSequenceForKeyPressedEvent( | 93 GetInputSequenceForKeyPressedEvent( |
94 *MakeKeyEvent(true, 0, mojo::KeyboardCode::RIGHT), true)); | 94 *MakeKeyEvent(true, 0, mojo::KeyboardCode::RIGHT), true)); |
95 // TODO(vtl): Test this more thoroughly. Also other keypad keys (once that's | 95 // TODO(vtl): Test this more thoroughly. Also other keypad keys (once that's |
96 // implemented). | 96 // implemented). |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
OLD | NEW |