Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/test/webdriver/webdriver_capabilities_parser.cc

Issue 8995021: ignore null value in proxy servers and bypass list capabilities (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/webdriver/webdriver_capabilities_parser.h" 5 #include "chrome/test/webdriver/webdriver_capabilities_parser.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 const char kSslProxy[] = "sslProxy"; 313 const char kSslProxy[] = "sslProxy";
314 314
315 std::set<std::string> proxy_servers_options; 315 std::set<std::string> proxy_servers_options;
316 proxy_servers_options.insert(kFtpProxy); 316 proxy_servers_options.insert(kFtpProxy);
317 proxy_servers_options.insert(kHttpProxy); 317 proxy_servers_options.insert(kHttpProxy);
318 proxy_servers_options.insert(kSslProxy); 318 proxy_servers_options.insert(kSslProxy);
319 319
320 Error* error = NULL; 320 Error* error = NULL;
321 Value* option = NULL; 321 Value* option = NULL;
322 bool has_manual_settings = false; 322 bool has_manual_settings = false;
323 if (options->Get(kNoProxy, &option)) { 323 if (options->Get(kNoProxy, &option) && !option->IsType(Value::TYPE_NULL)) {
324 error = ParseNoProxy(option); 324 error = ParseNoProxy(option);
325 if (error) 325 if (error)
326 return error; 326 return error;
327 has_manual_settings = true; 327 has_manual_settings = true;
328 } 328 }
329 329
330 std::vector<std::string> proxy_servers; 330 std::vector<std::string> proxy_servers;
331 std::set<std::string>::const_iterator iter = proxy_servers_options.begin(); 331 std::set<std::string>::const_iterator iter = proxy_servers_options.begin();
332 for (; iter != proxy_servers_options.end(); ++iter) { 332 for (; iter != proxy_servers_options.end(); ++iter) {
333 if (options->Get(*iter, &option)) { 333 if (options->Get(*iter, &option) && !option->IsType(Value::TYPE_NULL)) {
334 std::string value; 334 std::string value;
335 if (!option->GetAsString(&value)) 335 if (!option->GetAsString(&value))
336 return CreateBadInputError(*iter, Value::TYPE_STRING, option); 336 return CreateBadInputError(*iter, Value::TYPE_STRING, option);
337 has_manual_settings = true; 337 has_manual_settings = true;
338 // Converts into Chrome proxy scheme. 338 // Converts into Chrome proxy scheme.
339 // Example: "http=localhost:9000;ftp=localhost:8000". 339 // Example: "http=localhost:9000;ftp=localhost:8000".
340 if (*iter == kFtpProxy) 340 if (*iter == kFtpProxy)
341 value = "ftp=" + value; 341 value = "ftp=" + value;
342 if (*iter == kHttpProxy) 342 if (*iter == kHttpProxy)
343 value = "http=" + value; 343 value = "http=" + value;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } else { 403 } else {
404 if (!file_util::WriteFile(path, data.c_str(), data.length())) { 404 if (!file_util::WriteFile(path, data.c_str(), data.length())) {
405 *error_msg = "Could not write file"; 405 *error_msg = "Could not write file";
406 return false; 406 return false;
407 } 407 }
408 } 408 }
409 return true; 409 return true;
410 } 410 }
411 411
412 } // namespace webdriver 412 } // namespace webdriver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698