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