| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 void TearDown() { | 48 void TearDown() { |
| 49 ASSERT_EQ(chdir(original_working_dir_.c_str()), 0); | 49 ASSERT_EQ(chdir(original_working_dir_.c_str()), 0); |
| 50 } | 50 } |
| 51 private: | 51 private: |
| 52 static std::string original_working_dir_; | 52 static std::string original_working_dir_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 std::string FileUtilsTest::original_working_dir_ = ""; | 55 std::string FileUtilsTest::original_working_dir_ = ""; |
| 56 | 56 |
| 57 // Tests that the project root path is returned for the default working | 57 // Tests that the project output dir path is returned for the default working |
| 58 // directory that is automatically set when the test executable is launched. | 58 // directory that is automatically set when the test executable is launched. |
| 59 // The test is not fully testing the implementation, since we cannot be sure | 59 // The test is not fully testing the implementation, since we cannot be sure |
| 60 // of where the executable was launched from. | 60 // of where the executable was launched from. |
| 61 TEST_F(FileUtilsTest, ProjectRootPath) { | |
| 62 std::string project_root = webrtc::test::ProjectRootPath(); | |
| 63 // Not very smart, but at least tests something. | |
| 64 ASSERT_GT(project_root.length(), 0u); | |
| 65 } | |
| 66 | |
| 67 // Similar to the above test, but for the output dir | |
| 68 #if defined(WEBRTC_ANDROID) | 61 #if defined(WEBRTC_ANDROID) |
| 69 #define MAYBE_OutputPathFromUnchangedWorkingDir \ | 62 #define MAYBE_OutputPathFromUnchangedWorkingDir \ |
| 70 DISABLED_OutputPathFromUnchangedWorkingDir | 63 DISABLED_OutputPathFromUnchangedWorkingDir |
| 71 #else | 64 #else |
| 72 #define MAYBE_OutputPathFromUnchangedWorkingDir \ | 65 #define MAYBE_OutputPathFromUnchangedWorkingDir \ |
| 73 OutputPathFromUnchangedWorkingDir | 66 OutputPathFromUnchangedWorkingDir |
| 74 #endif | 67 #endif |
| 75 TEST_F(FileUtilsTest, MAYBE_OutputPathFromUnchangedWorkingDir) { | 68 TEST_F(FileUtilsTest, MAYBE_OutputPathFromUnchangedWorkingDir) { |
| 76 std::string path = webrtc::test::OutputPath(); | 69 std::string path = webrtc::test::OutputPath(); |
| 77 std::string expected_end = "out"; | 70 std::string expected_end = "out"; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 fclose(file); | 137 fclose(file); |
| 145 ASSERT_GT(webrtc::test::GetFileSize(std::string(temp_filename.c_str())), 0u); | 138 ASSERT_GT(webrtc::test::GetFileSize(std::string(temp_filename.c_str())), 0u); |
| 146 remove(temp_filename.c_str()); | 139 remove(temp_filename.c_str()); |
| 147 } | 140 } |
| 148 | 141 |
| 149 TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) { | 142 TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) { |
| 150 ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp")); | 143 ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp")); |
| 151 } | 144 } |
| 152 | 145 |
| 153 } // namespace webrtc | 146 } // namespace webrtc |
| OLD | NEW |