| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 | 389 |
| 390 std::string Switches::ToString() const { | 390 std::string Switches::ToString() const { |
| 391 std::string str; | 391 std::string str; |
| 392 SwitchMap::const_iterator iter = switch_map_.begin(); | 392 SwitchMap::const_iterator iter = switch_map_.begin(); |
| 393 while (iter != switch_map_.end()) { | 393 while (iter != switch_map_.end()) { |
| 394 str += "--" + iter->first; | 394 str += "--" + iter->first; |
| 395 std::string value = GetSwitchValue(iter->first); | 395 std::string value = GetSwitchValue(iter->first); |
| 396 if (value.length()) { | 396 if (value.length()) { |
| 397 if (value.find(' ') != std::string::npos) | 397 if (value.find(' ') != std::string::npos) |
| 398 value = base::GetDoubleQuotedJson(value); | 398 value = base::GetQuotedJSONString(value); |
| 399 str += "=" + value; | 399 str += "=" + value; |
| 400 } | 400 } |
| 401 ++iter; | 401 ++iter; |
| 402 if (iter == switch_map_.end()) | 402 if (iter == switch_map_.end()) |
| 403 break; | 403 break; |
| 404 str += " "; | 404 str += " "; |
| 405 } | 405 } |
| 406 return str; | 406 return str; |
| 407 } | 407 } |
| 408 | 408 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 432 if (desired_caps.Get(it->first, &capability)) { | 432 if (desired_caps.Get(it->first, &capability)) { |
| 433 Status status = it->second.Run(*capability, this); | 433 Status status = it->second.Run(*capability, this); |
| 434 if (status.IsError()) { | 434 if (status.IsError()) { |
| 435 return Status( | 435 return Status( |
| 436 kUnknownError, "cannot parse capability: " + it->first, status); | 436 kUnknownError, "cannot parse capability: " + it->first, status); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 return Status(kOk); | 440 return Status(kOk); |
| 441 } | 441 } |
| OLD | NEW |