Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / test / chromedriver / key_converter.h
blobeabc6caec384c03032c4a5b95dbd5ae4f5396314
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_
8 #include <list>
9 #include <string>
11 #include "base/strings/string16.h"
12 #include "ui/events/keycodes/keyboard_codes.h"
14 struct KeyEvent;
15 class Status;
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,
22 int modifiers);
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,
31 int* modifiers,
32 std::list<KeyEvent>* key_events);
34 #endif // CHROME_TEST_CHROMEDRIVER_KEY_CONVERTER_H_