OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_CHROMEDRIVER_UTIL_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_UTIL_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_UTIL_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace base { | 10 namespace base { |
11 class FilePath; | 11 class FilePath; |
12 class ListValue; | 12 class ListValue; |
13 } | 13 } |
14 | 14 |
| 15 struct Session; |
15 class Status; | 16 class Status; |
16 class WebView; | 17 class WebView; |
17 | 18 |
18 // Generates a random, 32-character hexidecimal ID. | 19 // Generates a random, 32-character hexidecimal ID. |
19 std::string GenerateId(); | 20 std::string GenerateId(); |
20 | 21 |
21 // Send a sequence of key strokes to the active Element in window. | 22 // Send a sequence of key strokes to the active Element in window. |
22 Status SendKeysOnWindow( | 23 Status SendKeysOnWindow( |
23 WebView* web_view, | 24 WebView* web_view, |
24 const base::ListValue* key_list, | 25 const base::ListValue* key_list, |
25 bool release_modifiers, | 26 bool release_modifiers, |
26 int* sticky_modifiers); | 27 int* sticky_modifiers); |
27 | 28 |
28 // Decodes the given base64-encoded string, after removing any newlines, | 29 // Decodes the given base64-encoded string, after removing any newlines, |
29 // which are required in some base64 standards. Returns true on success. | 30 // which are required in some base64 standards. Returns true on success. |
30 bool Base64Decode(const std::string& base64, std::string* bytes); | 31 bool Base64Decode(const std::string& base64, std::string* bytes); |
31 | 32 |
32 // Unzips the sole file contained in the given zip data |bytes| into | 33 // Unzips the sole file contained in the given zip data |bytes| into |
33 // |unzip_dir|. The zip data may be a normal zip archive or a single zip file | 34 // |unzip_dir|. The zip data may be a normal zip archive or a single zip file |
34 // entry. If the unzip successfully produced one file, returns true and sets | 35 // entry. If the unzip successfully produced one file, returns true and sets |
35 // |file| to the unzipped file. | 36 // |file| to the unzipped file. |
36 // TODO(kkania): Remove the ability to parse single zip file entries when | 37 // TODO(kkania): Remove the ability to parse single zip file entries when |
37 // the current versions of all WebDriver clients send actual zip files. | 38 // the current versions of all WebDriver clients send actual zip files. |
38 Status UnzipSoleFile(const base::FilePath& unzip_dir, | 39 Status UnzipSoleFile(const base::FilePath& unzip_dir, |
39 const std::string& bytes, | 40 const std::string& bytes, |
40 base::FilePath* file); | 41 base::FilePath* file); |
41 | 42 |
| 43 // Calls BeforeCommand for each of |session|'s |CommandListener|s. |
| 44 void NotifySessionListenersBeforeCommand(Session* session, |
| 45 const std::string& command_name); |
| 46 |
42 #endif // CHROME_TEST_CHROMEDRIVER_UTIL_H_ | 47 #endif // CHROME_TEST_CHROMEDRIVER_UTIL_H_ |
OLD | NEW |