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_UTIL_H_
6 #define CHROME_TEST_CHROMEDRIVER_UTIL_H_
19 // Generates a random, 32-character hexidecimal ID.
20 std::string
GenerateId();
22 // Send a sequence of key strokes to the active Element in window.
23 Status
SendKeysOnWindow(
25 const base::ListValue
* key_list
,
26 bool release_modifiers
,
27 int* sticky_modifiers
);
29 // Decodes the given base64-encoded string, after removing any newlines,
30 // which are required in some base64 standards. Returns true on success.
31 bool Base64Decode(const std::string
& base64
, std::string
* bytes
);
33 // 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
35 // entry. If the unzip successfully produced one file, returns true and sets
36 // |file| to the unzipped file.
37 // TODO(kkania): Remove the ability to parse single zip file entries when
38 // the current versions of all WebDriver clients send actual zip files.
39 Status
UnzipSoleFile(const base::FilePath
& unzip_dir
,
40 const std::string
& bytes
,
41 base::FilePath
* file
);
43 // Calls BeforeCommand for each of |session|'s |CommandListener|s.
44 // If an error is encountered, will mark |session| for deletion and return.
45 Status
NotifyCommandListenersBeforeCommand(Session
* session
,
46 const std::string
& command_name
);
48 #endif // CHROME_TEST_CHROMEDRIVER_UTIL_H_