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

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

Issue 10986042: Fix the failed cases in URLFetcherFileTest on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: refine the patch with nits fixed Created 8 years, 1 month 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/test/remote_test_server.h ('k') | net/url_request/url_fetcher_impl_unittest.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 (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 "net/test/remote_test_server.h" 5 #include "net/test/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/file_path.h" 10 #include "base/file_path.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 bool RemoteTestServer::Stop() { 136 bool RemoteTestServer::Stop() {
137 if (!spawner_communicator_.get()) 137 if (!spawner_communicator_.get())
138 return true; 138 return true;
139 CleanUpWhenStoppingServer(); 139 CleanUpWhenStoppingServer();
140 bool stopped = spawner_communicator_->StopServer(); 140 bool stopped = spawner_communicator_->StopServer();
141 // Explicitly reset |spawner_communicator_| to avoid reusing the stopped one. 141 // Explicitly reset |spawner_communicator_| to avoid reusing the stopped one.
142 spawner_communicator_.reset(NULL); 142 spawner_communicator_.reset(NULL);
143 return stopped; 143 return stopped;
144 } 144 }
145 145
146 // On Android, the document root in the device is not the same as the document
147 // root in the host machine where the test server is launched. So prepend
148 // DIR_SOURCE_ROOT here to get the actual path of document root on the Android
149 // device.
150 FilePath RemoteTestServer::GetDocumentRoot() const {
151 FilePath src_dir;
152 PathService::Get(base::DIR_SOURCE_ROOT, &src_dir);
153 return src_dir.Append(document_root());
154 }
155
146 bool RemoteTestServer::Init(const FilePath& document_root) { 156 bool RemoteTestServer::Init(const FilePath& document_root) {
147 if (document_root.IsAbsolute()) 157 if (document_root.IsAbsolute())
148 return false; 158 return false;
149 159
150 // Gets ports information used by test server spawner and Python test server. 160 // Gets ports information used by test server spawner and Python test server.
151 int test_server_port = 0; 161 int test_server_port = 0;
152 162
153 // Parse file to extract the ports information. 163 // Parse file to extract the ports information.
154 std::string port_info; 164 std::string port_info;
155 if (!file_util::ReadFileToString(GetTestServerPortInfoFile(), 165 if (!file_util::ReadFileToString(GetTestServerPortInfoFile(),
(...skipping 22 matching lines...) Expand all
178 188
179 SetResourcePath(document_root, FilePath().AppendASCII("net") 189 SetResourcePath(document_root, FilePath().AppendASCII("net")
180 .AppendASCII("data") 190 .AppendASCII("data")
181 .AppendASCII("ssl") 191 .AppendASCII("ssl")
182 .AppendASCII("certificates")); 192 .AppendASCII("certificates"));
183 return true; 193 return true;
184 } 194 }
185 195
186 } // namespace net 196 } // namespace net
187 197
OLDNEW
« no previous file with comments | « net/test/remote_test_server.h ('k') | net/url_request/url_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698