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

Side by Side Diff: base/command_line.cc

Issue 11184050: [content shell] add support for getting tests from the command line. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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
« no previous file with comments | « no previous file | base/command_line_unittest.cc » ('j') | content/shell/shell_browser_main.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 5 #include "base/command_line.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return 0; 43 return 0;
44 } 44 }
45 45
46 // Fills in |switch_string| and |switch_value| if |string| is a switch. 46 // Fills in |switch_string| and |switch_value| if |string| is a switch.
47 // This will preserve the input switch prefix in the output |switch_string|. 47 // This will preserve the input switch prefix in the output |switch_string|.
48 bool IsSwitch(const CommandLine::StringType& string, 48 bool IsSwitch(const CommandLine::StringType& string,
49 CommandLine::StringType* switch_string, 49 CommandLine::StringType* switch_string,
50 CommandLine::StringType* switch_value) { 50 CommandLine::StringType* switch_value) {
51 switch_string->clear(); 51 switch_string->clear();
52 switch_value->clear(); 52 switch_value->clear();
53 if (GetSwitchPrefixLength(string) == 0) 53 size_t prefix_length = GetSwitchPrefixLength(string);
54 if (prefix_length == 0 || prefix_length == string.length())
marja 2012/10/18 20:53:57 nit: extra space here
jochen (gone - plz use gerrit) 2012/10/18 21:06:42 Done.
54 return false; 55 return false;
55 56
56 const size_t equals_position = string.find(kSwitchValueSeparator); 57 const size_t equals_position = string.find(kSwitchValueSeparator);
57 *switch_string = string.substr(0, equals_position); 58 *switch_string = string.substr(0, equals_position);
58 if (equals_position != CommandLine::StringType::npos) 59 if (equals_position != CommandLine::StringType::npos)
59 *switch_value = string.substr(equals_position + 1); 60 *switch_value = string.substr(equals_position + 1);
60 return true; 61 return true;
61 } 62 }
62 63
63 // Append switches and arguments, keeping switches before arguments. 64 // Append switches and arguments, keeping switches before arguments.
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 int num_args = 0; 396 int num_args = 0;
396 wchar_t** args = NULL; 397 wchar_t** args = NULL;
397 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); 398 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args);
398 399
399 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " 400 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: "
400 << command_line; 401 << command_line;
401 InitFromArgv(num_args, args); 402 InitFromArgv(num_args, args);
402 LocalFree(args); 403 LocalFree(args);
403 } 404 }
404 #endif 405 #endif
OLDNEW
« no previous file with comments | « no previous file | base/command_line_unittest.cc » ('j') | content/shell/shell_browser_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698