2e618ed7ae442bc28920f97b0c0fa13d6e2de6bf
[platform/framework/web/crosswalk.git] / src / chrome / test / chromedriver / util.h
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.
4
5 #ifndef CHROME_TEST_CHROMEDRIVER_UTIL_H_
6 #define CHROME_TEST_CHROMEDRIVER_UTIL_H_
7
8 #include <string>
9
10 namespace base {
11 class FilePath;
12 class ListValue;
13 }
14
15 class Status;
16 class WebView;
17
18 // Generates a random, 32-character hexidecimal ID.
19 std::string GenerateId();
20
21 // Send a sequence of key strokes to the active Element in window.
22 Status SendKeysOnWindow(
23     WebView* web_view,
24     const base::ListValue* key_list,
25     bool release_modifiers,
26     int* sticky_modifiers);
27
28 // Decodes the given base64-encoded string, after removing any newlines,
29 // which are required in some base64 standards. Returns true on success.
30 bool Base64Decode(const std::string& base64, std::string* bytes);
31
32 // 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 // entry. If the unzip successfully produced one file, returns true and sets
35 // |file| to the unzipped file.
36 // 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 Status UnzipSoleFile(const base::FilePath& unzip_dir,
39                      const std::string& bytes,
40                      base::FilePath* file);
41
42 #endif  // CHROME_TEST_CHROMEDRIVER_UTIL_H_