| 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_CAPABILITIES_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_CAPABILITIES_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_CAPABILITIES_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_CAPABILITIES_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/strings/string16.h" |
| 15 #include "chrome/test/chromedriver/net/net_util.h" | 17 #include "chrome/test/chromedriver/net/net_util.h" |
| 16 | 18 |
| 17 namespace base { | 19 namespace base { |
| 18 class DictionaryValue; | 20 class DictionaryValue; |
| 19 } | 21 } |
| 20 | 22 |
| 23 class CommandLine; |
| 21 class Log; | 24 class Log; |
| 22 class Status; | 25 class Status; |
| 23 | 26 |
| 27 class Switches { |
| 28 public: |
| 29 typedef base::FilePath::StringType NativeString; |
| 30 Switches(); |
| 31 ~Switches(); |
| 32 |
| 33 void SetSwitch(const std::string& name); |
| 34 void SetSwitch(const std::string& name, const std::string& value); |
| 35 void SetSwitch(const std::string& name, const string16& value); |
| 36 void SetSwitch(const std::string& name, const base::FilePath& value); |
| 37 |
| 38 // In case of same key, |switches| will override. |
| 39 void SetFromSwitches(const Switches& switches); |
| 40 |
| 41 // Sets a switch from the capabilities, of the form [--]name[=value]. |
| 42 void SetUnparsedSwitch(const std::string& unparsed_switch); |
| 43 |
| 44 void RemoveSwitch(const std::string& name); |
| 45 |
| 46 bool HasSwitch(const std::string& name) const; |
| 47 std::string GetSwitchValue(const std::string& name) const; |
| 48 NativeString GetSwitchValueNative(const std::string& name) const; |
| 49 |
| 50 size_t GetSize() const; |
| 51 |
| 52 void AppendToCommandLine(CommandLine* command) const; |
| 53 std::string ToString() const; |
| 54 |
| 55 private: |
| 56 typedef std::map<std::string, NativeString> SwitchMap; |
| 57 SwitchMap switch_map_; |
| 58 }; |
| 59 |
| 24 struct Capabilities { | 60 struct Capabilities { |
| 25 Capabilities(); | 61 Capabilities(); |
| 26 ~Capabilities(); | 62 ~Capabilities(); |
| 27 | 63 |
| 28 // Return true if existing host:port session is to be used. | 64 // Return true if existing host:port session is to be used. |
| 29 bool IsExistingBrowser() const; | 65 bool IsExistingBrowser() const; |
| 30 | 66 |
| 31 // Return true if android package is specified. | 67 // Return true if android package is specified. |
| 32 bool IsAndroid() const; | 68 bool IsAndroid() const; |
| 33 | 69 |
| 34 Status Parse(const base::DictionaryValue& desired_caps, Log* log); | 70 Status Parse(const base::DictionaryValue& desired_caps, Log* log); |
| 35 | 71 |
| 36 // True if should always use DevTools for taking screenshots. | 72 std::string android_activity; |
| 37 // This is experimental and may be removed at a later point. | 73 |
| 38 bool force_devtools_screenshot; | 74 std::string android_device_serial; |
| 75 |
| 76 std::string android_package; |
| 77 |
| 78 std::string android_process; |
| 79 |
| 80 base::FilePath binary; |
| 81 |
| 82 // If provided, the remote debugging address to connect to. |
| 83 NetAddress debugger_address; |
| 39 | 84 |
| 40 // Whether the lifetime of the started Chrome browser process should be | 85 // Whether the lifetime of the started Chrome browser process should be |
| 41 // bound to ChromeDriver's process. If true, Chrome will not quit if | 86 // bound to ChromeDriver's process. If true, Chrome will not quit if |
| 42 // ChromeDriver dies. | 87 // ChromeDriver dies. |
| 43 bool detach; | 88 bool detach; |
| 44 | 89 |
| 45 std::string android_package; | |
| 46 std::string android_activity; | |
| 47 std::string android_process; | |
| 48 std::string android_device_serial; | |
| 49 std::string android_args; | |
| 50 | |
| 51 std::string log_path; | |
| 52 CommandLine command; | |
| 53 scoped_ptr<base::DictionaryValue> prefs; | |
| 54 scoped_ptr<base::DictionaryValue> local_state; | |
| 55 std::vector<std::string> extensions; | |
| 56 scoped_ptr<base::DictionaryValue> logging_prefs; | |
| 57 | |
| 58 // Set of switches which should be removed from default list when launching | 90 // Set of switches which should be removed from default list when launching |
| 59 // Chrome. | 91 // Chrome. |
| 60 std::set<std::string> exclude_switches; | 92 std::set<std::string> exclude_switches; |
| 61 | 93 |
| 62 // If provided, the remote debugging address to connect to. | 94 std::vector<std::string> extensions; |
| 63 NetAddress use_existing_browser; | 95 |
| 96 // True if should always use DevTools for taking screenshots. |
| 97 // This is experimental and may be removed at a later point. |
| 98 bool force_devtools_screenshot; |
| 99 |
| 100 scoped_ptr<base::DictionaryValue> local_state; |
| 101 |
| 102 std::string log_path; |
| 103 |
| 104 scoped_ptr<base::DictionaryValue> logging_prefs; |
| 105 |
| 106 scoped_ptr<base::DictionaryValue> prefs; |
| 107 |
| 108 Switches switches; |
| 64 }; | 109 }; |
| 65 | 110 |
| 66 #endif // CHROME_TEST_CHROMEDRIVER_CAPABILITIES_H_ | 111 #endif // CHROME_TEST_CHROMEDRIVER_CAPABILITIES_H_ |
| OLD | NEW |