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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
« no previous file with comments | « net/log/write_to_file_net_log_observer.cc ('k') | net/tools/get_server_time/get_server_time.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/remote_test_server.h" 5 #include "net/test/spawned_test_server/remote_test_server.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return false; 96 return false;
97 97
98 arguments_dict.Set("on-remote-server", base::Value::CreateNullValue()); 98 arguments_dict.Set("on-remote-server", base::Value::CreateNullValue());
99 99
100 // Append the 'server-type' argument which is used by spawner server to 100 // Append the 'server-type' argument which is used by spawner server to
101 // pass right server type to Python test server. 101 // pass right server type to Python test server.
102 arguments_dict.SetString("server-type", GetServerTypeString(type())); 102 arguments_dict.SetString("server-type", GetServerTypeString(type()));
103 103
104 // Generate JSON-formatted argument string. 104 // Generate JSON-formatted argument string.
105 std::string arguments_string; 105 std::string arguments_string;
106 base::JSONWriter::Write(&arguments_dict, &arguments_string); 106 base::JSONWriter::Write(arguments_dict, &arguments_string);
107 if (arguments_string.empty()) 107 if (arguments_string.empty())
108 return false; 108 return false;
109 109
110 // Start the Python test server on the remote machine. 110 // Start the Python test server on the remote machine.
111 uint16 test_server_port; 111 uint16 test_server_port;
112 if (!spawner_communicator_->StartServer(arguments_string, 112 if (!spawner_communicator_->StartServer(arguments_string,
113 &test_server_port)) { 113 &test_server_port)) {
114 return false; 114 return false;
115 } 115 }
116 if (0 == test_server_port) 116 if (0 == test_server_port)
117 return false; 117 return false;
118 118
119 // Construct server data to initialize BaseTestServer::server_data_. 119 // Construct server data to initialize BaseTestServer::server_data_.
120 base::DictionaryValue server_data_dict; 120 base::DictionaryValue server_data_dict;
121 // At this point, the test server should be spawned on the host. Update the 121 // At this point, the test server should be spawned on the host. Update the
122 // local port to real port of Python test server, which will be forwarded to 122 // local port to real port of Python test server, which will be forwarded to
123 // the remote server. 123 // the remote server.
124 server_data_dict.SetInteger("port", test_server_port); 124 server_data_dict.SetInteger("port", test_server_port);
125 std::string server_data; 125 std::string server_data;
126 base::JSONWriter::Write(&server_data_dict, &server_data); 126 base::JSONWriter::Write(server_data_dict, &server_data);
127 if (server_data.empty() || !ParseServerData(server_data)) { 127 if (server_data.empty() || !ParseServerData(server_data)) {
128 LOG(ERROR) << "Could not parse server_data: " << server_data; 128 LOG(ERROR) << "Could not parse server_data: " << server_data;
129 return false; 129 return false;
130 } 130 }
131 131
132 return SetupWhenServerStarted(); 132 return SetupWhenServerStarted();
133 } 133 }
134 134
135 bool RemoteTestServer::StartInBackground() { 135 bool RemoteTestServer::StartInBackground() {
136 NOTIMPLEMENTED(); 136 NOTIMPLEMENTED();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 fixed_root = base::FilePath(base::FilePath::kCurrentDirectory); 201 fixed_root = base::FilePath(base::FilePath::kCurrentDirectory);
202 SetResourcePath(fixed_root, base::FilePath().AppendASCII("net") 202 SetResourcePath(fixed_root, base::FilePath().AppendASCII("net")
203 .AppendASCII("data") 203 .AppendASCII("data")
204 .AppendASCII("ssl") 204 .AppendASCII("ssl")
205 .AppendASCII("certificates")); 205 .AppendASCII("certificates"));
206 return true; 206 return true;
207 } 207 }
208 208
209 } // namespace net 209 } // namespace net
210 210
OLDNEW
« no previous file with comments | « net/log/write_to_file_net_log_observer.cc ('k') | net/tools/get_server_time/get_server_time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698