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 19 matching lines...) Loading... |
30 | 30 |
31 namespace webrtc { | 31 namespace webrtc { |
32 | 32 |
33 // Test fixture to restore the working directory between each test, since some | 33 // Test fixture to restore the working directory between each test, since some |
34 // of them change it with chdir during execution (not restored by the | 34 // of them change it with chdir during execution (not restored by the |
35 // gtest framework). | 35 // gtest framework). |
36 class FileUtilsTest : public testing::Test { | 36 class FileUtilsTest : public testing::Test { |
37 protected: | 37 protected: |
38 FileUtilsTest() { | 38 FileUtilsTest() { |
39 } | 39 } |
40 virtual ~FileUtilsTest() {} | 40 ~FileUtilsTest() override {} |
41 // Runs before the first test | 41 // Runs before the first test |
42 static void SetUpTestCase() { | 42 static void SetUpTestCase() { |
43 original_working_dir_ = webrtc::test::WorkingDir(); | 43 original_working_dir_ = webrtc::test::WorkingDir(); |
44 } | 44 } |
45 void SetUp() { | 45 void SetUp() override { |
46 ASSERT_EQ(chdir(original_working_dir_.c_str()), 0); | 46 ASSERT_EQ(chdir(original_working_dir_.c_str()), 0); |
47 } | 47 } |
48 void TearDown() { | 48 void TearDown() override { |
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 output dir 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. |
(...skipping 78 matching lines...) Loading... |
137 fclose(file); | 137 fclose(file); |
138 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); |
139 remove(temp_filename.c_str()); | 139 remove(temp_filename.c_str()); |
140 } | 140 } |
141 | 141 |
142 TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) { | 142 TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) { |
143 ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp")); | 143 ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp")); |
144 } | 144 } |
145 | 145 |
146 } // namespace webrtc | 146 } // namespace webrtc |
OLD | NEW |