test_artifacts.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2016 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. #ifndef TEST_TESTSUPPORT_TEST_ARTIFACTS_H_
  11. #define TEST_TESTSUPPORT_TEST_ARTIFACTS_H_
  12. #include <stdint.h>
  13. #include <stdlib.h>
  14. #include <string>
  15. namespace webrtc {
  16. namespace test {
  17. // If the test_artifacts_dir flag is set, returns true and copies the location
  18. // of the dir to |out_dir|. Otherwise, return false.
  19. bool GetTestArtifactsDir(std::string* out_dir);
  20. // Writes a |length| bytes array |buffer| to |filename| in isolated output
  21. // directory defined by swarming. If the file is existing, content will be
  22. // appended. Otherwise a new file will be created. This function returns false
  23. // if isolated output directory has not been defined, or |filename| indicates an
  24. // invalid or non-writable file, or underlying file system errors.
  25. bool WriteToTestArtifactsDir(const char* filename,
  26. const uint8_t* buffer,
  27. size_t length);
  28. bool WriteToTestArtifactsDir(const char* filename, const std::string& content);
  29. } // namespace test
  30. } // namespace webrtc
  31. #endif // TEST_TESTSUPPORT_TEST_ARTIFACTS_H_