1// Copyright (c) 2011 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.
4
5#ifndef CHROME_COMMON_AUTOMATION_CONSTANTS_H__
6#define CHROME_COMMON_AUTOMATION_CONSTANTS_H__
7#pragma once
8
9namespace automation {
10
11// JSON value labels for proxy settings that are passed in via
12// AutomationMsg_SetProxyConfig. These are here since they are used by both
13// AutomationProvider and AutomationProxy.
14extern const char kJSONProxyAutoconfig[];
15extern const char kJSONProxyNoProxy[];
16extern const char kJSONProxyPacUrl[];
17extern const char kJSONProxyBypassList[];
18extern const char kJSONProxyServer[];
19
20// When passing the kTestingChannelID switch to the browser, prepend
21// this prefix to the channel id to enable the named testing interface.
22// Named testing interface is used when you want to connect an
23// AutomationProxy to an already-running browser instance.
24extern const char kNamedInterfacePrefix[];
25
26// Amount of time to wait before querying the browser.
27static const int kSleepTime = 250;
28
29// Recognized by the AutomationProvider's SendWebKeyboardEventToSelectedTab
30// command. Specifies the type of the keyboard event.
31enum KeyEventTypes {
32  kRawKeyDownType = 0,
33  kKeyDownType,
34  kCharType,
35  kKeyUpType,
36};
37
38// Recognized by the AutomationProvider's SendWebKeyboardEventToSelectedTab
39// command. Specifies masks to be used in constructing keyboard event modifiers.
40enum KeyModifierMasks {
41  kShiftKeyMask   = 1 << 0,
42  kControlKeyMask = 1 << 1,
43  kAltKeyMask     = 1 << 2,
44  kMetaKeyMask    = 1 << 3,
45};
46
47enum MouseButton {
48  kLeftButton = 0,
49  kMiddleButton,
50  kRightButton,
51};
52
53// The current version of ChromeDriver automation supported by Chrome.
54// This needs to be incremented for each change to ChromeDriver automation that
55// is not backwards compatible. Some examples of this would be:
56// - SendJSONRequest or Hello IPC messages change
57// - The interface for an individual ChromeDriver automation call changes in an
58//   incompatible way
59// TODO(kkania): Investigate a better backwards compatible automation solution.
60extern const int kChromeDriverAutomationVersion;
61
62}  // namespace automation
63
64// Used by AutomationProxy, declared here so that other headers don't need
65// to include automation_proxy.h.
66enum AutomationLaunchResult {
67  AUTOMATION_LAUNCH_RESULT_INVALID = -1,
68  AUTOMATION_SUCCESS,
69  AUTOMATION_TIMEOUT,
70  AUTOMATION_VERSION_MISMATCH,
71  AUTOMATION_CREATE_TAB_FAILED,
72  AUTOMATION_SERVER_CRASHED,
73};
74
75enum AutomationMsg_NavigationResponseValues {
76  AUTOMATION_MSG_NAVIGATION_ERROR = 0,
77  AUTOMATION_MSG_NAVIGATION_SUCCESS,
78  AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED,
79};
80
81enum AutomationMsg_ExtensionResponseValues {
82  AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED = 0,
83  AUTOMATION_MSG_EXTENSION_INSTALL_FAILED
84};
85
86// Used in the AutomationMsg_GetExtensionProperty to identify which extension
87// property should be retrieved, instead of having separate messages for each
88// property.
89enum AutomationMsg_ExtensionProperty {
90  AUTOMATION_MSG_EXTENSION_ID = 0,
91  AUTOMATION_MSG_EXTENSION_NAME,
92  AUTOMATION_MSG_EXTENSION_VERSION,
93  AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX,
94};
95
96
97#endif  // CHROME_COMMON_AUTOMATION_CONSTANTS_H__
98