Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBDRIVER_WEBDRIVER_CAPABILITIES_PARSER_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_CAPABILITIES_PARSER_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_CAPABILITIES_PARSER_H_ | 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_CAPABILITIES_PARSER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 namespace webdriver { | 21 namespace webdriver { |
| 22 | 22 |
| 23 class Error; | 23 class Error; |
| 24 | 24 |
| 25 // Contains all the capabilities that a user may request when starting a | 25 // Contains all the capabilities that a user may request when starting a |
| 26 // new session. | 26 // new session. |
| 27 struct Capabilities { | 27 struct Capabilities { |
| 28 Capabilities(); | 28 Capabilities(); |
| 29 ~Capabilities(); | 29 ~Capabilities(); |
| 30 | 30 |
| 31 // Whether Chrome should perform SSL certification revocation checking. | |
| 32 // In some test environments, these checks can take a long time. | |
| 33 bool cert_revocation_checking; | |
| 34 | |
| 31 // Command line to use for starting Chrome. | 35 // Command line to use for starting Chrome. |
| 32 CommandLine command; | 36 CommandLine command; |
| 33 | 37 |
| 34 // Channel ID to use for connecting to an already running Chrome. | 38 // Channel ID to use for connecting to an already running Chrome. |
| 35 std::string channel; | 39 std::string channel; |
| 36 | 40 |
| 37 // Whether the lifetime of the started Chrome browser process should be | 41 // Whether the lifetime of the started Chrome browser process should be |
| 38 // bound to ChromeDriver's process. If true, Chrome will not quit if | 42 // bound to ChromeDriver's process. If true, Chrome will not quit if |
| 39 // ChromeDriver dies. | 43 // ChromeDriver dies. |
| 40 bool detach; | 44 bool detach; |
| 41 | 45 |
| 42 // List of paths for extensions to install on startup. | 46 // List of paths for extensions to install on startup. |
| 43 std::vector<FilePath> extensions; | 47 std::vector<FilePath> extensions; |
| 44 | 48 |
| 45 // Whether Chrome should not block when loading. | 49 // Whether Chrome should not block when loading. |
| 46 bool load_async; | 50 bool load_async; |
| 47 | 51 |
| 48 // Whether Chrome should simulate input events using OS APIs instead of | 52 // Whether Chrome should simulate input events using OS APIs instead of |
| 49 // WebKit APIs. | 53 // WebKit APIs. |
| 50 bool native_events; | 54 bool native_events; |
| 51 | 55 |
| 52 // Path to a custom profile to use. | 56 // Path to a custom profile to use. |
| 53 FilePath profile; | 57 FilePath profile; |
| 54 | 58 |
| 59 // If true, ChromeDriver will bypass certain configuration options that | |
|
Huyen
2011/12/09 23:56:55
same comment as in webdriver_session.h.
Maybe reor
kkania
2011/12/10 00:37:44
Done.
| |
| 60 // are convenient for normal website testing with WebDriver. E.g., if | |
| 61 // false, ChromeDriver will configure Chrome so that websites automatically | |
| 62 // can track user location without running into an infobar. | |
| 63 bool no_website_testing_defaults; | |
| 64 | |
| 55 // Whether ChromeDriver should log verbosely. | 65 // Whether ChromeDriver should log verbosely. |
| 56 bool verbose; | 66 bool verbose; |
| 57 }; | 67 }; |
| 58 | 68 |
| 59 // Parses the given capabilities dictionary to produce a |Capabilities| | 69 // Parses the given capabilities dictionary to produce a |Capabilities| |
| 60 // instance. | 70 // instance. |
| 61 // See webdriver's desired capabilities for more info. | 71 // See webdriver's desired capabilities for more info. |
| 62 class CapabilitiesParser { | 72 class CapabilitiesParser { |
| 63 public: | 73 public: |
| 64 // Create a new parser. |capabilities_dict| is the dictionary for all | 74 // Create a new parser. |capabilities_dict| is the dictionary for all |
| 65 // of the user's desired capabilities. |root_path| is the root directory | 75 // of the user's desired capabilities. |root_path| is the root directory |
| 66 // to use for writing any necessary files to disk. This function will not | 76 // to use for writing any necessary files to disk. This function will not |
| 67 // create it or delete it. All files written to disk will be placed in | 77 // create it or delete it. All files written to disk will be placed in |
| 68 // this directory. | 78 // this directory. |
| 69 CapabilitiesParser(const base::DictionaryValue* capabilities_dict, | 79 CapabilitiesParser(const base::DictionaryValue* capabilities_dict, |
| 70 const FilePath& root_path, | 80 const FilePath& root_path, |
| 71 Capabilities* capabilities); | 81 Capabilities* capabilities); |
| 72 ~CapabilitiesParser(); | 82 ~CapabilitiesParser(); |
| 73 | 83 |
| 74 // Parses the capabilities. May return an error. | 84 // Parses the capabilities. May return an error. |
| 75 Error* Parse(); | 85 Error* Parse(); |
| 76 | 86 |
| 77 private: | 87 private: |
| 78 Error* ParseArgs(const base::Value* option); | 88 Error* ParseArgs(const base::Value* option); |
| 79 Error* ParseBinary(const base::Value* option); | 89 Error* ParseBinary(const base::Value* option); |
| 90 Error* ParseCertRevocationChecking(const base::Value* option); | |
| 80 Error* ParseChannel(const base::Value* option); | 91 Error* ParseChannel(const base::Value* option); |
| 81 Error* ParseDetach(const base::Value* option); | 92 Error* ParseDetach(const base::Value* option); |
| 82 Error* ParseExtensions(const base::Value* option); | 93 Error* ParseExtensions(const base::Value* option); |
| 83 Error* ParseLoadAsync(const base::Value* option); | 94 Error* ParseLoadAsync(const base::Value* option); |
| 84 Error* ParseNativeEvents(const base::Value* option); | 95 Error* ParseNativeEvents(const base::Value* option); |
| 85 Error* ParseProfile(const base::Value* option); | 96 Error* ParseProfile(const base::Value* option); |
| 97 Error* ParseNoWebsiteTestingDefaults(const base::Value* option); | |
| 86 Error* ParseVerbose(const base::Value* option); | 98 Error* ParseVerbose(const base::Value* option); |
| 87 // Decodes the given base64-encoded string, optionally unzips it, and | 99 // Decodes the given base64-encoded string, optionally unzips it, and |
| 88 // writes the result to |path|. | 100 // writes the result to |path|. |
| 89 // On error, false will be returned and |error_msg| will be set. | 101 // On error, false will be returned and |error_msg| will be set. |
| 90 bool DecodeAndWriteFile(const FilePath& path, | 102 bool DecodeAndWriteFile(const FilePath& path, |
| 91 const std::string& base64, | 103 const std::string& base64, |
| 92 bool unzip, | 104 bool unzip, |
| 93 std::string* error_msg); | 105 std::string* error_msg); |
| 94 | 106 |
| 95 // The capabilities dictionary to parse. | 107 // The capabilities dictionary to parse. |
| 96 const base::DictionaryValue* dict_; | 108 const base::DictionaryValue* dict_; |
| 97 | 109 |
| 98 // The root directory under which to write all files. | 110 // The root directory under which to write all files. |
| 99 const FilePath root_; | 111 const FilePath root_; |
| 100 | 112 |
| 101 // A pointer to the capabilities to modify while parsing. | 113 // A pointer to the capabilities to modify while parsing. |
| 102 Capabilities* caps_; | 114 Capabilities* caps_; |
| 103 | 115 |
| 104 DISALLOW_COPY_AND_ASSIGN(CapabilitiesParser); | 116 DISALLOW_COPY_AND_ASSIGN(CapabilitiesParser); |
| 105 }; | 117 }; |
| 106 | 118 |
| 107 } // namespace webdriver | 119 } // namespace webdriver |
| 108 | 120 |
| 109 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_CAPABILITIES_PARSER_H_ | 121 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_CAPABILITIES_PARSER_H_ |
| OLD | NEW |