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