OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 EXPECT_TRUE(Filesystem::DeleteFile(path)); | 83 EXPECT_TRUE(Filesystem::DeleteFile(path)); |
84 } | 84 } |
85 | 85 |
86 // Test checking for free disk space. | 86 // Test checking for free disk space. |
87 TEST(FilesystemTest, TestGetDiskFreeSpace) { | 87 TEST(FilesystemTest, TestGetDiskFreeSpace) { |
88 // Note that we should avoid picking any file/folder which could be located | 88 // Note that we should avoid picking any file/folder which could be located |
89 // at the remotely mounted drive/device. | 89 // at the remotely mounted drive/device. |
90 Pathname path; | 90 Pathname path; |
91 ASSERT_TRUE(Filesystem::GetAppDataFolder(&path, true)); | 91 ASSERT_TRUE(Filesystem::GetAppDataFolder(&path, true)); |
92 | 92 |
93 int64 free1 = 0; | 93 int64_t free1 = 0; |
94 EXPECT_TRUE(Filesystem::IsFolder(path)); | 94 EXPECT_TRUE(Filesystem::IsFolder(path)); |
95 EXPECT_FALSE(Filesystem::IsFile(path)); | 95 EXPECT_FALSE(Filesystem::IsFile(path)); |
96 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free1)); | 96 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free1)); |
97 EXPECT_GT(free1, 0); | 97 EXPECT_GT(free1, 0); |
98 | 98 |
99 int64 free2 = 0; | 99 int64_t free2 = 0; |
100 path.AppendFolder("this_folder_doesnt_exist"); | 100 path.AppendFolder("this_folder_doesnt_exist"); |
101 EXPECT_FALSE(Filesystem::IsFolder(path)); | 101 EXPECT_FALSE(Filesystem::IsFolder(path)); |
102 EXPECT_TRUE(Filesystem::IsAbsent(path)); | 102 EXPECT_TRUE(Filesystem::IsAbsent(path)); |
103 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free2)); | 103 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free2)); |
104 // These should be the same disk, and disk free space should not have changed | 104 // These should be the same disk, and disk free space should not have changed |
105 // by more than 1% between the two calls. | 105 // by more than 1% between the two calls. |
106 EXPECT_LT(static_cast<int64>(free1 * .9), free2); | 106 EXPECT_LT(static_cast<int64_t>(free1 * .9), free2); |
107 EXPECT_LT(free2, static_cast<int64>(free1 * 1.1)); | 107 EXPECT_LT(free2, static_cast<int64_t>(free1 * 1.1)); |
108 | 108 |
109 int64 free3 = 0; | 109 int64_t free3 = 0; |
110 path.clear(); | 110 path.clear(); |
111 EXPECT_TRUE(path.empty()); | 111 EXPECT_TRUE(path.empty()); |
112 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free3)); | 112 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free3)); |
113 // Current working directory may not be where exe is. | 113 // Current working directory may not be where exe is. |
114 // EXPECT_LT(static_cast<int64>(free1 * .9), free3); | 114 // EXPECT_LT(static_cast<int64_t>(free1 * .9), free3); |
115 // EXPECT_LT(free3, static_cast<int64>(free1 * 1.1)); | 115 // EXPECT_LT(free3, static_cast<int64_t>(free1 * 1.1)); |
116 EXPECT_GT(free3, 0); | 116 EXPECT_GT(free3, 0); |
117 } | 117 } |
118 | 118 |
119 // Tests that GetCurrentDirectory() returns something. | 119 // Tests that GetCurrentDirectory() returns something. |
120 TEST(FilesystemTest, TestGetCurrentDirectory) { | 120 TEST(FilesystemTest, TestGetCurrentDirectory) { |
121 EXPECT_FALSE(Filesystem::GetCurrentDirectory().empty()); | 121 EXPECT_FALSE(Filesystem::GetCurrentDirectory().empty()); |
122 } | 122 } |
123 | 123 |
124 // Tests that GetAppPathname returns something. | 124 // Tests that GetAppPathname returns something. |
125 TEST(FilesystemTest, TestGetAppPathname) { | 125 TEST(FilesystemTest, TestGetAppPathname) { |
126 Pathname path; | 126 Pathname path; |
127 EXPECT_TRUE(Filesystem::GetAppPathname(&path)); | 127 EXPECT_TRUE(Filesystem::GetAppPathname(&path)); |
128 EXPECT_FALSE(path.empty()); | 128 EXPECT_FALSE(path.empty()); |
129 } | 129 } |
130 | 130 |
131 } // namespace rtc | 131 } // namespace rtc |
OLD | NEW |