diff options
| author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-05 21:53:11 +0000 |
|---|---|---|
| committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-05 21:53:11 +0000 |
| commit | d1f1b75f7174b9a90365a0b1e17ce9141942a7ee (patch) | |
| tree | 76c963815cd1b94a7dc71081a591f1847d2801fb /chrome/test/webdriver/webdriver_util.h | |
| parent | 66495020df687ba383fdb57997ed6349af19ebcc (diff) | |
| download | chromium_src-d1f1b75f7174b9a90365a0b1e17ce9141942a7ee.zip chromium_src-d1f1b75f7174b9a90365a0b1e17ce9141942a7ee.tar.gz chromium_src-d1f1b75f7174b9a90365a0b1e17ce9141942a7ee.tar.bz2 | |
[chromedriver] Add command for uploading a file to a remote ChromeDriver server,
which can be used when performing a file upload using sendKeys.
Unfortunately, past and current versions of some WebDriver clients,
including java, only upload a zip entry and not an actual zip. This can't be
parsed by chromium's zip utilities or minizip. The WebDriver clients should
be changed to send an actual zip file. In the meantime, we append a central
directory on to the zip entry and then unzip it.
BUG=chromedriver:18
TEST=none
Review URL: http://codereview.chromium.org/9515005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/webdriver/webdriver_util.h')
| -rw-r--r-- | chrome/test/webdriver/webdriver_util.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/test/webdriver/webdriver_util.h b/chrome/test/webdriver/webdriver_util.h index 2628e0e..9450c5e 100644 --- a/chrome/test/webdriver/webdriver_util.h +++ b/chrome/test/webdriver/webdriver_util.h @@ -24,6 +24,28 @@ namespace webdriver { // Generates a random, 32-character hexidecimal ID. std::string GenerateRandomID(); +// Decodes the given base64-encoded string, after removing any newlines, +// which are required in some base64 standards. +// Returns true on success. +bool Base64Decode(const std::string& base64, std::string* bytes); + +// Unzip the given zip archive, after base64 decoding, into the given directory. +// Returns true on success. +bool Base64DecodeAndUnzip(const FilePath& unzip_dir, + const std::string& base64, + std::string* error_msg); + +// Unzips the sole file contained in the given zip data |bytes| into +// |unzip_dir|. The zip data may be a normal zip archive or a single zip file +// entry. If the unzip successfully produced one file, returns true and sets +// |file| to the unzipped file. +// TODO(kkania): Remove the ability to parse single zip file entries when +// the current versions of all WebDriver clients send actual zip files. +bool UnzipSoleFile(const FilePath& unzip_dir, + const std::string& bytes, + FilePath* file, + std::string* error_msg); + // Returns the equivalent JSON string for the given value. std::string JsonStringify(const base::Value* value); |
