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

Side by Side Diff: net/test/spawned_test_server/local_test_server.cc

Issue 196413016: Move CommandLine to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "net/test/spawned_test_server/local_test_server.h" 5 #include "net/test/spawned_test_server/local_test_server.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/process/kill.h" 11 #include "base/process/kill.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "net/base/host_port_pair.h" 14 #include "net/base/host_port_pair.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/test/python_utils.h" 16 #include "net/test/python_utils.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 namespace { 21 namespace {
22 22
23 bool AppendArgumentFromJSONValue(const std::string& key, 23 bool AppendArgumentFromJSONValue(const std::string& key,
24 const base::Value& value_node, 24 const base::Value& value_node,
25 CommandLine* command_line) { 25 base::CommandLine* command_line) {
26 std::string argument_name = "--" + key; 26 std::string argument_name = "--" + key;
27 switch (value_node.GetType()) { 27 switch (value_node.GetType()) {
28 case base::Value::TYPE_NULL: 28 case base::Value::TYPE_NULL:
29 command_line->AppendArg(argument_name); 29 command_line->AppendArg(argument_name);
30 break; 30 break;
31 case base::Value::TYPE_INTEGER: { 31 case base::Value::TYPE_INTEGER: {
32 int value; 32 int value;
33 bool result = value_node.GetAsInteger(&value); 33 bool result = value_node.GetAsInteger(&value);
34 DCHECK(result); 34 DCHECK(result);
35 command_line->AppendArg(argument_name + "=" + base::IntToString(value)); 35 command_line->AppendArg(argument_name + "=" + base::IntToString(value));
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (!GetPyProtoPath(&pyproto_dir)) { 191 if (!GetPyProtoPath(&pyproto_dir)) {
192 LOG(WARNING) << "Cannot find pyproto dir for generated code. " 192 LOG(WARNING) << "Cannot find pyproto dir for generated code. "
193 << "Testserver features that rely on it will not work"; 193 << "Testserver features that rely on it will not work";
194 return true; 194 return true;
195 } 195 }
196 AppendToPythonPath(pyproto_dir); 196 AppendToPythonPath(pyproto_dir);
197 197
198 return true; 198 return true;
199 } 199 }
200 200
201 bool LocalTestServer::AddCommandLineArguments(CommandLine* command_line) const { 201 bool LocalTestServer::AddCommandLineArguments(
202 base::CommandLine* command_line) const {
202 base::DictionaryValue arguments_dict; 203 base::DictionaryValue arguments_dict;
203 if (!GenerateArguments(&arguments_dict)) 204 if (!GenerateArguments(&arguments_dict))
204 return false; 205 return false;
205 206
206 // Serialize the argument dictionary into CommandLine. 207 // Serialize the argument dictionary into CommandLine.
207 for (base::DictionaryValue::Iterator it(arguments_dict); !it.IsAtEnd(); 208 for (base::DictionaryValue::Iterator it(arguments_dict); !it.IsAtEnd();
208 it.Advance()) { 209 it.Advance()) {
209 const base::Value& value = it.value(); 210 const base::Value& value = it.value();
210 const std::string& key = it.key(); 211 const std::string& key = it.key();
211 212
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 break; 250 break;
250 default: 251 default:
251 NOTREACHED(); 252 NOTREACHED();
252 return false; 253 return false;
253 } 254 }
254 255
255 return true; 256 return true;
256 } 257 }
257 258
258 } // namespace net 259 } // namespace net
OLDNEW
« no previous file with comments | « net/test/spawned_test_server/local_test_server.h ('k') | net/test/spawned_test_server/local_test_server_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698