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" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 capabilities->switches.SetSwitch("proxy-pac-url", proxy_pac_url); | 250 capabilities->switches.SetSwitch("proxy-pac-url", proxy_pac_url); |
251 } else if (proxy_type == "autodetect") { | 251 } else if (proxy_type == "autodetect") { |
252 capabilities->switches.SetSwitch("proxy-auto-detect"); | 252 capabilities->switches.SetSwitch("proxy-auto-detect"); |
253 } else if (proxy_type == "manual") { | 253 } else if (proxy_type == "manual") { |
254 const char* const proxy_servers_options[][2] = { | 254 const char* const proxy_servers_options[][2] = { |
255 {"ftpProxy", "ftp"}, {"httpProxy", "http"}, {"sslProxy", "https"}}; | 255 {"ftpProxy", "ftp"}, {"httpProxy", "http"}, {"sslProxy", "https"}}; |
256 const base::Value* option_value = NULL; | 256 const base::Value* option_value = NULL; |
257 std::string proxy_servers; | 257 std::string proxy_servers; |
258 for (size_t i = 0; i < arraysize(proxy_servers_options); ++i) { | 258 for (size_t i = 0; i < arraysize(proxy_servers_options); ++i) { |
259 if (!proxy_dict->Get(proxy_servers_options[i][0], &option_value) || | 259 if (!proxy_dict->Get(proxy_servers_options[i][0], &option_value) || |
260 option_value->IsType(base::Value::TYPE_NULL)) { | 260 option_value->IsType(base::Value::Type::NONE)) { |
261 continue; | 261 continue; |
262 } | 262 } |
263 std::string value; | 263 std::string value; |
264 if (!option_value->GetAsString(&value)) { | 264 if (!option_value->GetAsString(&value)) { |
265 return Status( | 265 return Status( |
266 kUnknownError, | 266 kUnknownError, |
267 base::StringPrintf("'%s' must be a string", | 267 base::StringPrintf("'%s' must be a string", |
268 proxy_servers_options[i][0])); | 268 proxy_servers_options[i][0])); |
269 } | 269 } |
270 // Converts into Chrome proxy scheme. | 270 // Converts into Chrome proxy scheme. |
271 // Example: "http=localhost:9000;ftp=localhost:8000". | 271 // Example: "http=localhost:9000;ftp=localhost:8000". |
272 if (!proxy_servers.empty()) | 272 if (!proxy_servers.empty()) |
273 proxy_servers += ";"; | 273 proxy_servers += ";"; |
274 proxy_servers += base::StringPrintf( | 274 proxy_servers += base::StringPrintf( |
275 "%s=%s", proxy_servers_options[i][1], value.c_str()); | 275 "%s=%s", proxy_servers_options[i][1], value.c_str()); |
276 } | 276 } |
277 | 277 |
278 std::string proxy_bypass_list; | 278 std::string proxy_bypass_list; |
279 if (proxy_dict->Get("noProxy", &option_value) && | 279 if (proxy_dict->Get("noProxy", &option_value) && |
280 !option_value->IsType(base::Value::TYPE_NULL)) { | 280 !option_value->IsType(base::Value::Type::NONE)) { |
281 if (!option_value->GetAsString(&proxy_bypass_list)) | 281 if (!option_value->GetAsString(&proxy_bypass_list)) |
282 return Status(kUnknownError, "'noProxy' must be a string"); | 282 return Status(kUnknownError, "'noProxy' must be a string"); |
283 } | 283 } |
284 | 284 |
285 if (proxy_servers.empty() && proxy_bypass_list.empty()) { | 285 if (proxy_servers.empty() && proxy_bypass_list.empty()) { |
286 return Status(kUnknownError, | 286 return Status(kUnknownError, |
287 "proxyType is 'manual' but no manual " | 287 "proxyType is 'manual' but no manual " |
288 "proxy capabilities were found"); | 288 "proxy capabilities were found"); |
289 } | 289 } |
290 if (!proxy_servers.empty()) | 290 if (!proxy_servers.empty()) |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 if (iter == logging_prefs.end() || iter->second == Log::kOff) { | 657 if (iter == logging_prefs.end() || iter->second == Log::kOff) { |
658 const base::DictionaryValue* chrome_options = NULL; | 658 const base::DictionaryValue* chrome_options = NULL; |
659 if (desired_caps.GetDictionary("chromeOptions", &chrome_options) && | 659 if (desired_caps.GetDictionary("chromeOptions", &chrome_options) && |
660 chrome_options->HasKey("perfLoggingPrefs")) { | 660 chrome_options->HasKey("perfLoggingPrefs")) { |
661 return Status(kUnknownError, "perfLoggingPrefs specified, " | 661 return Status(kUnknownError, "perfLoggingPrefs specified, " |
662 "but performance logging was not enabled"); | 662 "but performance logging was not enabled"); |
663 } | 663 } |
664 } | 664 } |
665 return Status(kOk); | 665 return Status(kOk); |
666 } | 666 } |
OLD | NEW |