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 #include "chrome/test/chromedriver/capabilities.h" | 5 #include "chrome/test/chromedriver/capabilities.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/test/chromedriver/chrome/status.h" | 14 #include "chrome/test/chromedriver/chrome/status.h" |
| 15 #include "chrome/test/chromedriver/logging.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 typedef base::Callback<Status(const base::Value&, Capabilities*)> Parser; | 19 typedef base::Callback<Status(const base::Value&, Capabilities*)> Parser; |
19 | 20 |
20 Status ParseChromeBinary( | 21 Status ParseChromeBinary( |
21 const base::Value& option, | 22 const base::Value& option, |
22 Capabilities* capabilities) { | 23 Capabilities* capabilities) { |
23 base::FilePath::StringType path_str; | 24 base::FilePath::StringType path_str; |
24 if (!option.GetAsString(&path_str)) | 25 if (!option.GetAsString(&path_str)) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Status Capabilities::Parse(const base::DictionaryValue& desired_caps) { | 215 Status Capabilities::Parse(const base::DictionaryValue& desired_caps) { |
215 Status status = ParseAndroidChromeCapabilities(desired_caps, this); | 216 Status status = ParseAndroidChromeCapabilities(desired_caps, this); |
216 if (status.IsError()) | 217 if (status.IsError()) |
217 return status; | 218 return status; |
218 if (IsAndroid()) | 219 if (IsAndroid()) |
219 return Status(kOk); | 220 return Status(kOk); |
220 | 221 |
221 std::map<std::string, Parser> parser_map; | 222 std::map<std::string, Parser> parser_map; |
222 parser_map["proxy"] = base::Bind(&ParseProxy); | 223 parser_map["proxy"] = base::Bind(&ParseProxy); |
223 parser_map["chromeOptions"] = base::Bind(&ParseDesktopChromeOption); | 224 parser_map["chromeOptions"] = base::Bind(&ParseDesktopChromeOption); |
| 225 parser_map["loggingPrefs"] = base::Bind(&ParseLoggingPrefs); |
224 for (std::map<std::string, Parser>::iterator it = parser_map.begin(); | 226 for (std::map<std::string, Parser>::iterator it = parser_map.begin(); |
225 it != parser_map.end(); ++it) { | 227 it != parser_map.end(); ++it) { |
226 const base::Value* capability = NULL; | 228 const base::Value* capability = NULL; |
227 if (desired_caps.Get(it->first, &capability)) { | 229 if (desired_caps.Get(it->first, &capability)) { |
228 status = it->second.Run(*capability, this); | 230 status = it->second.Run(*capability, this); |
229 if (status.IsError()) | 231 if (status.IsError()) |
230 return status; | 232 return status; |
231 } | 233 } |
232 } | 234 } |
233 return Status(kOk); | 235 return Status(kOk); |
234 } | 236 } |
OLD | NEW |