| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 287 } |
| 288 return Status(kOk); | 288 return Status(kOk); |
| 289 } | 289 } |
| 290 | 290 |
| 291 Status ParseUseRemoteBrowser(const base::Value& option, | 291 Status ParseUseRemoteBrowser(const base::Value& option, |
| 292 Capabilities* capabilities) { | 292 Capabilities* capabilities) { |
| 293 std::string server_addr; | 293 std::string server_addr; |
| 294 if (!option.GetAsString(&server_addr)) | 294 if (!option.GetAsString(&server_addr)) |
| 295 return Status(kUnknownError, "must be 'host:port'"); | 295 return Status(kUnknownError, "must be 'host:port'"); |
| 296 | 296 |
| 297 std::vector<std::string> values; | 297 std::vector<std::string> values = base::SplitString( |
| 298 base::SplitString(server_addr, ':', &values); | 298 server_addr, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 299 if (values.size() != 2) | 299 if (values.size() != 2) |
| 300 return Status(kUnknownError, "must be 'host:port'"); | 300 return Status(kUnknownError, "must be 'host:port'"); |
| 301 | 301 |
| 302 int port = 0; | 302 int port = 0; |
| 303 base::StringToInt(values[1], &port); | 303 base::StringToInt(values[1], &port); |
| 304 if (port <= 0) | 304 if (port <= 0) |
| 305 return Status(kUnknownError, "port must be > 0"); | 305 return Status(kUnknownError, "port must be > 0"); |
| 306 | 306 |
| 307 capabilities->debugger_address = NetAddress(values[0], port); | 307 capabilities->debugger_address = NetAddress(values[0], port); |
| 308 return Status(kOk); | 308 return Status(kOk); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 if (iter == logging_prefs.end() || iter->second == Log::kOff) { | 593 if (iter == logging_prefs.end() || iter->second == Log::kOff) { |
| 594 const base::DictionaryValue* chrome_options = NULL; | 594 const base::DictionaryValue* chrome_options = NULL; |
| 595 if (desired_caps.GetDictionary("chromeOptions", &chrome_options) && | 595 if (desired_caps.GetDictionary("chromeOptions", &chrome_options) && |
| 596 chrome_options->HasKey("perfLoggingPrefs")) { | 596 chrome_options->HasKey("perfLoggingPrefs")) { |
| 597 return Status(kUnknownError, "perfLoggingPrefs specified, " | 597 return Status(kUnknownError, "perfLoggingPrefs specified, " |
| 598 "but performance logging was not enabled"); | 598 "but performance logging was not enabled"); |
| 599 } | 599 } |
| 600 } | 600 } |
| 601 return Status(kOk); | 601 return Status(kOk); |
| 602 } | 602 } |
| OLD | NEW |