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

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

Issue 2898753002: ReadDirectory() added in webrtc/test/testsupport/fileutils.h (Closed)
Patch Set: final changes and win trybot fix gtest Created 3 years, 6 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 | « no previous file | webrtc/test/testsupport/fileutils.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 /* 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 #include <vector>
18
19 #include "webrtc/base/optional.h"
17 20
18 namespace webrtc { 21 namespace webrtc {
19 namespace test { 22 namespace test {
20 23
21 // This is the "directory" returned if the ProjectPath() function fails 24 // This is the "directory" returned if the ProjectPath() function fails
22 // to find the project root. 25 // to find the project root.
23 extern const char* kCannotFindProjectRootDir; 26 extern const char* kCannotFindProjectRootDir;
24 27
25 // Creates and returns the absolute path to the output directory where log files 28 // 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 29 // and other test artifacts should be put. The output directory is generally a
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // hierarchy reflecting that path is assumed to be present. 62 // hierarchy reflecting that path is assumed to be present.
60 // extension - File extension, without the dot, i.e. "bmp" or "yuv". 63 // extension - File extension, without the dot, i.e. "bmp" or "yuv".
61 std::string ResourcePath(const std::string& name, 64 std::string ResourcePath(const std::string& name,
62 const std::string& extension); 65 const std::string& extension);
63 66
64 // Gets the current working directory for the executing program. 67 // Gets the current working directory for the executing program.
65 // Returns "./" if for some reason it is not possible to find the working 68 // Returns "./" if for some reason it is not possible to find the working
66 // directory. 69 // directory.
67 std::string WorkingDir(); 70 std::string WorkingDir();
68 71
72 // Reads the content of a directory and, in case of success, returns a vector
73 // of strings with one element for each found file or directory. Each element is
74 // a path created by prepending |dir| to the file/directory name. "." and ".."
75 // are never added in the returned vector.
76 rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path);
77
69 // Creates a directory if it not already exists. 78 // Creates a directory if it not already exists.
70 // Returns true if successful. Will print an error message to stderr and return 79 // Returns true if successful. Will print an error message to stderr and return
71 // false if a file with the same name already exists. 80 // false if a file with the same name already exists.
72 bool CreateDir(const std::string& directory_name); 81 bool CreateDir(const std::string& directory_name);
73 82
74 // Removes a directory, which must already be empty. 83 // Removes a directory, which must already be empty.
75 bool RemoveDir(const std::string& directory_name); 84 bool RemoveDir(const std::string& directory_name);
76 85
77 // Removes a file. 86 // Removes a file.
78 bool RemoveFile(const std::string& file_name); 87 bool RemoveFile(const std::string& file_name);
(...skipping 13 matching lines...) Expand all
92 // but can also be an absolute path. The intention with this function is to pass 101 // 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 102 // 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 103 // fileutils.h to find the correct project paths even when the working directory
95 // is outside the project tree (which happens in some cases). 104 // is outside the project tree (which happens in some cases).
96 void SetExecutablePath(const std::string& path_to_executable); 105 void SetExecutablePath(const std::string& path_to_executable);
97 106
98 } // namespace test 107 } // namespace test
99 } // namespace webrtc 108 } // namespace webrtc
100 109
101 #endif // WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_ 110 #endif // WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/test/testsupport/fileutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698