file_utils_override.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  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. #include <string>
  11. #ifndef TEST_TESTSUPPORT_FILE_UTILS_OVERRIDE_H_
  12. #define TEST_TESTSUPPORT_FILE_UTILS_OVERRIDE_H_
  13. namespace webrtc {
  14. namespace test {
  15. namespace internal {
  16. // Returns the absolute path to the output directory where log files and other
  17. // test artifacts should be put. The output directory is generally a directory
  18. // named "out" at the project root. This root is assumed to be two levels above
  19. // where the test binary is located; this is because tests execute in a dir
  20. // out/Whatever relative to the project root. This convention is also followed
  21. // in Chromium.
  22. //
  23. // The exception is Android where we use /sdcard/ instead.
  24. //
  25. // If symbolic links occur in the path they will be resolved and the actual
  26. // directory will be returned.
  27. //
  28. // Returns the path WITH a trailing path delimiter. If the project root is not
  29. // found, the current working directory ("./") is returned as a fallback.
  30. std::string OutputPath();
  31. // Gets the current working directory for the executing program.
  32. // Returns "./" if for some reason it is not possible to find the working
  33. // directory.
  34. std::string WorkingDir();
  35. // Returns a full path to a resource file in the resources_dir dir.
  36. //
  37. // Arguments:
  38. // name - Name of the resource file. If a plain filename (no directory path)
  39. // is supplied, the file is assumed to be located in resources/
  40. // If a directory path is prepended to the filename, a subdirectory
  41. // hierarchy reflecting that path is assumed to be present.
  42. // extension - File extension, without the dot, i.e. "bmp" or "yuv".
  43. std::string ResourcePath(const std::string& name, const std::string& extension);
  44. } // namespace internal
  45. } // namespace test
  46. } // namespace webrtc
  47. #endif // TEST_TESTSUPPORT_FILE_UTILS_OVERRIDE_H_