OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/test/webdriver/webdriver_capabilities_parser.h" | 5 #include "chrome/test/webdriver/webdriver_capabilities_parser.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 JsonStringifyForDisplay(option).c_str())); | 31 JsonStringifyForDisplay(option).c_str())); |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 Capabilities::Capabilities() | 36 Capabilities::Capabilities() |
37 : command(CommandLine::NO_PROGRAM), | 37 : command(CommandLine::NO_PROGRAM), |
38 detach(false), | 38 detach(false), |
39 load_async(false), | 39 load_async(false), |
40 local_state(new DictionaryValue()), | 40 local_state(new DictionaryValue()), |
41 native_events(false), | |
42 no_website_testing_defaults(false), | 41 no_website_testing_defaults(false), |
43 prefs(new DictionaryValue()) { | 42 prefs(new DictionaryValue()) { |
44 log_levels[LogType::kDriver] = kAllLogLevel; | 43 log_levels[LogType::kDriver] = kAllLogLevel; |
45 } | 44 } |
46 | 45 |
47 Capabilities::~Capabilities() { } | 46 Capabilities::~Capabilities() { } |
48 | 47 |
49 CapabilitiesParser::CapabilitiesParser( | 48 CapabilitiesParser::CapabilitiesParser( |
50 const DictionaryValue* capabilities_dict, | 49 const DictionaryValue* capabilities_dict, |
51 const FilePath& root_path, | 50 const FilePath& root_path, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 std::string("loggingPrefs.") + *key_iter, | 249 std::string("loggingPrefs.") + *key_iter, |
251 Value::TYPE_STRING, | 250 Value::TYPE_STRING, |
252 level_value); | 251 level_value); |
253 } | 252 } |
254 caps_->log_levels[log_type.type()] = LogLevelFromString(level_name); | 253 caps_->log_levels[log_type.type()] = LogLevelFromString(level_name); |
255 } | 254 } |
256 return NULL; | 255 return NULL; |
257 } | 256 } |
258 | 257 |
259 Error* CapabilitiesParser::ParseNativeEvents(const Value* option) { | 258 Error* CapabilitiesParser::ParseNativeEvents(const Value* option) { |
260 if (!option->GetAsBoolean(&caps_->native_events)) | 259 bool native_events; |
| 260 if (!option->GetAsBoolean(&native_events)) |
261 return CreateBadInputError("nativeEvents", Value::TYPE_BOOLEAN, option); | 261 return CreateBadInputError("nativeEvents", Value::TYPE_BOOLEAN, option); |
| 262 if (native_events) |
| 263 return new Error(kUnknownError, "OS-level events are not supported"); |
262 return NULL; | 264 return NULL; |
263 } | 265 } |
264 | 266 |
265 Error* CapabilitiesParser::ParsePrefs(const Value* option) { | 267 Error* CapabilitiesParser::ParsePrefs(const Value* option) { |
266 const base::DictionaryValue* prefs; | 268 const base::DictionaryValue* prefs; |
267 if (!option->GetAsDictionary(&prefs)) | 269 if (!option->GetAsDictionary(&prefs)) |
268 return CreateBadInputError("prefs", Value::TYPE_DICTIONARY, option); | 270 return CreateBadInputError("prefs", Value::TYPE_DICTIONARY, option); |
269 caps_->prefs.reset(prefs->DeepCopy()); | 271 caps_->prefs.reset(prefs->DeepCopy()); |
270 return NULL; | 272 return NULL; |
271 } | 273 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (!switches->GetString(i, &switch_name)) { | 446 if (!switches->GetString(i, &switch_name)) { |
445 return new Error(kBadRequest, | 447 return new Error(kBadRequest, |
446 "Each switch to be removed must be a string"); | 448 "Each switch to be removed must be a string"); |
447 } | 449 } |
448 caps_->exclude_switches.insert(switch_name); | 450 caps_->exclude_switches.insert(switch_name); |
449 } | 451 } |
450 return NULL; | 452 return NULL; |
451 } | 453 } |
452 | 454 |
453 } // namespace webdriver | 455 } // namespace webdriver |
OLD | NEW |