OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_TEST_WEBDRIVER_WEBDRIVER_AUTOMATION_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_AUTOMATION_H_ |
6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_AUTOMATION_H_ | 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_AUTOMATION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/task.h" | 16 #include "base/task.h" |
17 #include "chrome/common/automation_constants.h" | 17 #include "chrome/common/automation_constants.h" |
18 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
19 | 19 |
20 class AutomationProxy; | 20 class AutomationProxy; |
21 class ProxyLauncher; | 21 class ProxyLauncher; |
22 struct WebKeyEvent; | 22 struct WebKeyEvent; |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class DictionaryValue; | 25 class DictionaryValue; |
26 class ListValue; | 26 class ListValue; |
| 27 class Value; |
27 } | 28 } |
28 | 29 |
29 namespace webdriver { | 30 namespace webdriver { |
30 | 31 |
31 class Error; | 32 class Error; |
32 class FramePath; | 33 class FramePath; |
33 class Point; | 34 class Point; |
34 | 35 |
35 // Creates and controls the Chrome instance. | 36 // Creates and controls the Chrome instance. |
36 // This class should be created and accessed on a single thread. | 37 // This class should be created and accessed on a single thread. |
(...skipping 14 matching lines...) Expand all Loading... |
51 FilePath user_data_dir; | 52 FilePath user_data_dir; |
52 | 53 |
53 // The channel ID of an already running browser to connect to. If empty, | 54 // The channel ID of an already running browser to connect to. If empty, |
54 // the browser will be launched with an anonymous channel. | 55 // the browser will be launched with an anonymous channel. |
55 std::string channel_id; | 56 std::string channel_id; |
56 | 57 |
57 // True if the Chrome process should only be terminated if quit is called. | 58 // True if the Chrome process should only be terminated if quit is called. |
58 // If false, Chrome will also be terminated if this process is killed or | 59 // If false, Chrome will also be terminated if this process is killed or |
59 // shutdown. | 60 // shutdown. |
60 bool detach_process; | 61 bool detach_process; |
| 62 |
| 63 // True if Chrome should perform SSL certification revocation checking. |
| 64 // In some test environments, these checks can take a long time. |
| 65 bool cert_revocation_checking; |
61 }; | 66 }; |
62 | 67 |
63 Automation(); | 68 Automation(); |
64 virtual ~Automation(); | 69 virtual ~Automation(); |
65 | 70 |
66 // Start the system's default Chrome binary. | 71 // Start the system's default Chrome binary. |
67 void Init(const BrowserOptions& options, Error** error); | 72 void Init(const BrowserOptions& options, Error** error); |
68 | 73 |
69 // Terminates this session and disconnects its automation proxy. After | 74 // Terminates this session and disconnects its automation proxy. After |
70 // invoking this method, the Automation can safely be deleted. | 75 // invoking this method, the Automation can safely be deleted. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 171 |
167 // Gets all installed extension IDs. | 172 // Gets all installed extension IDs. |
168 void GetInstalledExtensions(std::vector<std::string>* extension_ids, | 173 void GetInstalledExtensions(std::vector<std::string>* extension_ids, |
169 Error** error); | 174 Error** error); |
170 | 175 |
171 // Install a packed or unpacked extension. If the path ends with '.crx', | 176 // Install a packed or unpacked extension. If the path ends with '.crx', |
172 // the extension is assumed to be packed. | 177 // the extension is assumed to be packed. |
173 void InstallExtension(const FilePath& path, std::string* extension_id, | 178 void InstallExtension(const FilePath& path, std::string* extension_id, |
174 Error** error); | 179 Error** error); |
175 | 180 |
| 181 // Set a local state preference, which is not associated with any profile. |
| 182 // Ownership of |value| is taken by this function. |
| 183 void SetLocalStatePreference(const std::string& pref, |
| 184 base::Value* value, |
| 185 Error** error); |
| 186 |
| 187 // Set a user preference, which is associated with the current profile. |
| 188 // Ownership of |value| is taken by this fucntion. |
| 189 void SetPreference(const std::string& pref, |
| 190 base::Value* value, |
| 191 Error** error); |
| 192 |
176 private: | 193 private: |
177 AutomationProxy* automation() const; | 194 AutomationProxy* automation() const; |
178 Error* GetIndicesForTab(int tab_id, int* browser_index, int* tab_index); | 195 Error* GetIndicesForTab(int tab_id, int* browser_index, int* tab_index); |
179 Error* CompareVersion(int client_build_no, | 196 Error* CompareVersion(int client_build_no, |
180 int client_patch_no, | 197 int client_patch_no, |
181 bool* is_newer_or_equal); | 198 bool* is_newer_or_equal); |
182 Error* CheckVersion(int client_build_no, | 199 Error* CheckVersion(int client_build_no, |
183 int client_patch_no, | 200 int client_patch_no, |
184 const std::string& error_msg); | 201 const std::string& error_msg); |
185 Error* CheckAlertsSupported(); | 202 Error* CheckAlertsSupported(); |
186 Error* CheckAdvancedInteractionsSupported(); | 203 Error* CheckAdvancedInteractionsSupported(); |
187 Error* CheckNewExtensionInterfaceSupported(); | 204 Error* CheckNewExtensionInterfaceSupported(); |
188 | 205 |
189 scoped_ptr<ProxyLauncher> launcher_; | 206 scoped_ptr<ProxyLauncher> launcher_; |
190 | 207 |
191 DISALLOW_COPY_AND_ASSIGN(Automation); | 208 DISALLOW_COPY_AND_ASSIGN(Automation); |
192 }; | 209 }; |
193 | 210 |
194 } // namespace webdriver | 211 } // namespace webdriver |
195 | 212 |
196 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); | 213 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); |
197 | 214 |
198 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_AUTOMATION_H_ | 215 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_AUTOMATION_H_ |
OLD | NEW |