zijiehe | 2769ec6 | 2016-12-14 15:03:03 -0800 | [diff] [blame] | 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 | |
ilnik | e264a9e | 2017-07-25 07:31:18 -0700 | [diff] [blame] | 11 | #ifndef WEBRTC_TEST_TESTSUPPORT_TEST_OUTPUT_H_ |
| 12 | #define WEBRTC_TEST_TESTSUPPORT_TEST_OUTPUT_H_ |
zijiehe | 2769ec6 | 2016-12-14 15:03:03 -0800 | [diff] [blame] | 13 | |
| 14 | #include <stdlib.h> |
| 15 | |
| 16 | #include <string> |
| 17 | |
| 18 | namespace webrtc { |
| 19 | namespace test { |
| 20 | |
ilnik | e264a9e | 2017-07-25 07:31:18 -0700 | [diff] [blame] | 21 | // If the test_output_dir flag is set, returns true and copies the location of |
| 22 | // the dir to |out_dir|. Otherwise, return false. |
| 23 | bool GetTestOutputDir(std::string* out_dir); |
| 24 | |
zijiehe | 2769ec6 | 2016-12-14 15:03:03 -0800 | [diff] [blame] | 25 | // Writes a |length| bytes array |buffer| to |filename| in isolated output |
| 26 | // directory defined by swarming. If the file is existing, content will be |
| 27 | // appended. Otherwise a new file will be created. This function returns false |
| 28 | // if isolated output directory has not been defined, or |filename| indicates an |
| 29 | // invalid or non-writable file, or underlying file system errors. |
ilnik | e264a9e | 2017-07-25 07:31:18 -0700 | [diff] [blame] | 30 | bool WriteToTestOutput(const char* filename, |
| 31 | const uint8_t* buffer, |
| 32 | size_t length); |
zijiehe | 2769ec6 | 2016-12-14 15:03:03 -0800 | [diff] [blame] | 33 | |
ilnik | e264a9e | 2017-07-25 07:31:18 -0700 | [diff] [blame] | 34 | bool WriteToTestOutput(const char* filename, const std::string& content); |
zijiehe | 2769ec6 | 2016-12-14 15:03:03 -0800 | [diff] [blame] | 35 | |
| 36 | } // namespace test |
| 37 | } // namespace webrtc |
| 38 | |
ilnik | e264a9e | 2017-07-25 07:31:18 -0700 | [diff] [blame] | 39 | #endif // WEBRTC_TEST_TESTSUPPORT_TEST_OUTPUT_H_ |