1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_
6 #define CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_
11 #include "base/strings/string16.h"
12 #include "ui/events/keycodes/keyboard_codes.h"
17 // Convenience functions for creating |KeyEvent|s. Used by unittests.
18 KeyEvent
CreateKeyDownEvent(ui::KeyboardCode key_code
, int modifiers
);
19 KeyEvent
CreateKeyUpEvent(ui::KeyboardCode key_code
, int modifiers
);
20 KeyEvent
CreateCharEvent(const std::string
& unmodified_text
,
21 const std::string
& modified_text
,
24 // Converts keys into appropriate |KeyEvent|s. This will do a best effort
25 // conversion. However, if the input is invalid it will return a status with
26 // an error message. If |release_modifiers| is true, all modifiers would be
27 // depressed. |modifiers| acts both an input and an output, however, only when
28 // the conversion process is successful will |modifiers| be changed.
29 Status
ConvertKeysToKeyEvents(const base::string16
& keys
,
30 bool release_modifiers
,
32 std::list
<KeyEvent
>* key_events
);
34 #endif // CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_