Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: webrtc/base/fileutils_unittest.cc

Issue 2699143002: Delete unused Filesystem methods GetAppDataFolder and GetDiskFreeSpace. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/fileutils.h ('k') | webrtc/base/unixfilesystem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 Pathname path; 63 Pathname path;
64 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); 64 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL));
65 path.SetFilename("not an actual file"); 65 path.SetFilename("not an actual file");
66 66
67 EXPECT_FALSE(Filesystem::IsFile(path)); 67 EXPECT_FALSE(Filesystem::IsFile(path));
68 68
69 FileStream* fs = Filesystem::OpenFile(path, "rb"); 69 FileStream* fs = Filesystem::OpenFile(path, "rb");
70 EXPECT_FALSE(fs != NULL); 70 EXPECT_FALSE(fs != NULL);
71 } 71 }
72 72
73 // Test checking for free disk space.
74 TEST(MAYBE_FilesystemTest, TestGetDiskFreeSpace) {
75 // Note that we should avoid picking any file/folder which could be located
76 // at the remotely mounted drive/device.
77 Pathname path;
78 ASSERT_TRUE(Filesystem::GetAppDataFolder(&path, true));
79
80 int64_t free1 = 0;
81 EXPECT_TRUE(Filesystem::IsFolder(path));
82 EXPECT_FALSE(Filesystem::IsFile(path));
83 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free1));
84 EXPECT_GT(free1, 0);
85
86 int64_t free2 = 0;
87 path.AppendFolder("this_folder_doesnt_exist");
88 EXPECT_FALSE(Filesystem::IsFolder(path));
89 EXPECT_TRUE(Filesystem::IsAbsent(path));
90 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free2));
91 // These should be the same disk, and disk free space should not have changed
92 // by more than 1% between the two calls.
93 EXPECT_LT(static_cast<int64_t>(free1 * .9), free2);
94 EXPECT_LT(free2, static_cast<int64_t>(free1 * 1.1));
95
96 int64_t free3 = 0;
97 path.clear();
98 EXPECT_TRUE(path.empty());
99 EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free3));
100 // Current working directory may not be where exe is.
101 // EXPECT_LT(static_cast<int64_t>(free1 * .9), free3);
102 // EXPECT_LT(free3, static_cast<int64_t>(free1 * 1.1));
103 EXPECT_GT(free3, 0);
104 }
105
106 } // namespace rtc 73 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/fileutils.h ('k') | webrtc/base/unixfilesystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698