blob: 141c76860716ad7892edddbd8359931cf20b026b [file] [log] [blame]
Artem Titov8f726be2018-10-23 15:50:10 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include <stdio.h>
12#include <string>
13
14#ifndef TEST_TESTSUPPORT_FILEUTILS_OVERRIDE_H_
15#define TEST_TESTSUPPORT_FILEUTILS_OVERRIDE_H_
16
17namespace webrtc {
18namespace test {
19namespace internal {
20
21// Returns the absolute path to the output directory where log files and other
22// test artifacts should be put. The output directory is generally a directory
23// named "out" at the project root. This root is assumed to be two levels above
24// where the test binary is located; this is because tests execute in a dir
25// out/Whatever relative to the project root. This convention is also followed
26// in Chromium.
27//
28// The exception is Android where we use /sdcard/ instead.
29//
30// If symbolic links occur in the path they will be resolved and the actual
31// directory will be returned.
32//
33// Returns the path WITH a trailing path delimiter. If the project root is not
34// found, the current working directory ("./") is returned as a fallback.
35std::string OutputPath();
36
37// Gets the current working directory for the executing program.
38// Returns "./" if for some reason it is not possible to find the working
39// directory.
40std::string WorkingDir();
41
42// Returns a path to a resource file in [project-root]/resources/ dir.
43// Returns an absolute path
44//
45// Arguments:
46// name - Name of the resource file. If a plain filename (no directory path)
47// is supplied, the file is assumed to be located in resources/
48// If a directory path is prepended to the filename, a subdirectory
49// hierarchy reflecting that path is assumed to be present.
50// extension - File extension, without the dot, i.e. "bmp" or "yuv".
51std::string ResourcePath(const std::string& name, const std::string& extension);
52
53} // namespace internal
54} // namespace test
55} // namespace webrtc
56
57#endif // TEST_TESTSUPPORT_FILEUTILS_OVERRIDE_H_