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

Side by Side Diff: webrtc/test/testsupport/fileutils.cc

Issue 2872283002: Reduce dependencies on rtc::FileSystem in FileRotatingStream tests, adding helpers in webrtc::test:: (Closed)
Patch Set: Addressed nits. Created 3 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 | « webrtc/test/testsupport/fileutils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } else { 225 } else {
226 #ifdef WIN32 226 #ifdef WIN32
227 return _mkdir(directory_name.c_str()) == 0; 227 return _mkdir(directory_name.c_str()) == 0;
228 #else 228 #else
229 return mkdir(directory_name.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0; 229 return mkdir(directory_name.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0;
230 #endif 230 #endif
231 } 231 }
232 return true; 232 return true;
233 } 233 }
234 234
235 bool RemoveDir(const std::string& directory_name) {
236 #ifdef WIN32
237 return RemoveDirectoryA(directory_name.c_str()) != FALSE;
238 #else
239 return rmdir(directory_name.c_str()) == 0;
240 #endif
241 }
242
243 bool RemoveFile(const std::string& file_name) {
244 #ifdef WIN32
245 return DeleteFileA(file_name.c_str()) != FALSE;
246 #else
247 return unlink(file_name.c_str()) == 0;
248 #endif
249 }
250
235 std::string ResourcePath(const std::string& name, 251 std::string ResourcePath(const std::string& name,
236 const std::string& extension) { 252 const std::string& extension) {
237 #if defined(WEBRTC_IOS) 253 #if defined(WEBRTC_IOS)
238 return IOSResourcePath(name, extension); 254 return IOSResourcePath(name, extension);
239 #else 255 #else
240 std::string platform = "win"; 256 std::string platform = "win";
241 #ifdef WEBRTC_LINUX 257 #ifdef WEBRTC_LINUX
242 platform = "linux"; 258 platform = "linux";
243 #endif // WEBRTC_LINUX 259 #endif // WEBRTC_LINUX
244 #ifdef WEBRTC_MAC 260 #ifdef WEBRTC_MAC
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (fseek(f, 0, SEEK_END) == 0) { 300 if (fseek(f, 0, SEEK_END) == 0) {
285 size = ftell(f); 301 size = ftell(f);
286 } 302 }
287 fclose(f); 303 fclose(f);
288 } 304 }
289 return size; 305 return size;
290 } 306 }
291 307
292 } // namespace test 308 } // namespace test
293 } // namespace webrtc 309 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/testsupport/fileutils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698