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

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

Issue 2898753002: ReadDirectory() added in webrtc/test/testsupport/fileutils.h (Closed)
Patch Set: commented lines removed 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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
11 #include <stdio.h> 11 #include <stdio.h>
12 12
13 #ifndef WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_ 13 #ifndef WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
14 #define WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_ 14 #define WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
15 15
16 #include <string> 16 #include <string>
17 17
18 #if !defined(WEBRTC_WIN)
19 #include <dirent.h>
20 #include <sys/stat.h>
21 #endif
22
23 #include "webrtc/base/fileutils.h"
24 #include "webrtc/base/pathutils.h"
25
18 namespace webrtc { 26 namespace webrtc {
19 namespace test { 27 namespace test {
20 28
21 // This is the "directory" returned if the ProjectPath() function fails 29 // This is the "directory" returned if the ProjectPath() function fails
22 // to find the project root. 30 // to find the project root.
23 extern const char* kCannotFindProjectRootDir; 31 extern const char* kCannotFindProjectRootDir;
24 32
25 // Creates and returns the absolute path to the output directory where log files 33 // Creates and returns the absolute path to the output directory where log files
26 // and other test artifacts should be put. The output directory is generally a 34 // and other test artifacts should be put. The output directory is generally a
27 // directory named "out" at the top-level of the project, i.e. a subfolder to 35 // directory named "out" at the top-level of the project, i.e. a subfolder to
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Gets the current working directory for the executing program. 72 // Gets the current working directory for the executing program.
65 // Returns "./" if for some reason it is not possible to find the working 73 // Returns "./" if for some reason it is not possible to find the working
66 // directory. 74 // directory.
67 std::string WorkingDir(); 75 std::string WorkingDir();
68 76
69 // Creates a directory if it not already exists. 77 // Creates a directory if it not already exists.
70 // Returns true if successful. Will print an error message to stderr and return 78 // Returns true if successful. Will print an error message to stderr and return
71 // false if a file with the same name already exists. 79 // false if a file with the same name already exists.
72 bool CreateDir(const std::string& directory_name); 80 bool CreateDir(const std::string& directory_name);
73 81
82 // Removes a directory recursively and returns the number of deleted entries.
83 size_t RemoveDirRecursively(const rtc::Pathname& dir);
84
74 // Removes a directory, which must already be empty. 85 // Removes a directory, which must already be empty.
75 bool RemoveDir(const std::string& directory_name); 86 bool RemoveDir(const std::string& directory_name);
76 87
77 // Removes a file. 88 // Removes a file.
78 bool RemoveFile(const std::string& file_name); 89 bool RemoveFile(const std::string& file_name);
79 90
80 // Checks if a file exists. 91 // Checks if a file exists.
81 bool FileExists(const std::string& file_name); 92 bool FileExists(const std::string& file_name);
82 93
83 // Checks if a directory exists. 94 // Checks if a directory exists.
84 bool DirExists(const std::string& directory_name); 95 bool DirExists(const std::string& directory_name);
85 96
86 // File size of the supplied file in bytes. Will return 0 if the file is 97 // File size of the supplied file in bytes. Will return 0 if the file is
87 // empty or if the file does not exist/is readable. 98 // empty or if the file does not exist/is readable.
88 size_t GetFileSize(const std::string& filename); 99 size_t GetFileSize(const std::string& filename);
89 100
90 // Sets the executable path, i.e. the path to the executable that is being used 101 // Sets the executable path, i.e. the path to the executable that is being used
91 // when launching it. This is usually the path relative to the working directory 102 // when launching it. This is usually the path relative to the working directory
92 // but can also be an absolute path. The intention with this function is to pass 103 // but can also be an absolute path. The intention with this function is to pass
93 // the argv[0] being sent into the main function to make it possible for 104 // the argv[0] being sent into the main function to make it possible for
94 // fileutils.h to find the correct project paths even when the working directory 105 // fileutils.h to find the correct project paths even when the working directory
95 // is outside the project tree (which happens in some cases). 106 // is outside the project tree (which happens in some cases).
96 void SetExecutablePath(const std::string& path_to_executable); 107 void SetExecutablePath(const std::string& path_to_executable);
97 108
98 } // namespace test 109 } // namespace test
99 } // namespace webrtc 110 } // namespace webrtc
100 111
101 #endif // WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_ 112 #endif // WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698