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 |
| 11 #include <memory> |
| 12 |
11 #include "webrtc/base/fileutils.h" | 13 #include "webrtc/base/fileutils.h" |
12 #include "webrtc/base/gunit.h" | 14 #include "webrtc/base/gunit.h" |
13 #include "webrtc/base/pathutils.h" | 15 #include "webrtc/base/pathutils.h" |
14 #include "webrtc/base/stream.h" | 16 #include "webrtc/base/stream.h" |
15 | 17 |
16 namespace rtc { | 18 namespace rtc { |
17 | 19 |
18 // Make sure we can get a temp folder for the later tests. | 20 // Make sure we can get a temp folder for the later tests. |
19 TEST(FilesystemTest, GetTemporaryFolder) { | 21 TEST(FilesystemTest, GetTemporaryFolder) { |
20 Pathname path; | 22 Pathname path; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Pathname path; | 69 Pathname path; |
68 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); | 70 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); |
69 path.SetFilename("private_file_test"); | 71 path.SetFilename("private_file_test"); |
70 | 72 |
71 // First call should succeed because the file doesn't exist yet. | 73 // First call should succeed because the file doesn't exist yet. |
72 EXPECT_TRUE(Filesystem::CreatePrivateFile(path)); | 74 EXPECT_TRUE(Filesystem::CreatePrivateFile(path)); |
73 // Next call should fail, because now it exists. | 75 // Next call should fail, because now it exists. |
74 EXPECT_FALSE(Filesystem::CreatePrivateFile(path)); | 76 EXPECT_FALSE(Filesystem::CreatePrivateFile(path)); |
75 | 77 |
76 // Verify that we have permission to open the file for reading and writing. | 78 // Verify that we have permission to open the file for reading and writing. |
77 scoped_ptr<FileStream> fs(Filesystem::OpenFile(path, "wb")); | 79 std::unique_ptr<FileStream> fs(Filesystem::OpenFile(path, "wb")); |
78 EXPECT_TRUE(fs.get() != NULL); | 80 EXPECT_TRUE(fs.get() != NULL); |
79 // Have to close the file on Windows before it will let us delete it. | 81 // Have to close the file on Windows before it will let us delete it. |
80 fs.reset(); | 82 fs.reset(); |
81 | 83 |
82 // Verify that we have permission to delete the file. | 84 // Verify that we have permission to delete the file. |
83 EXPECT_TRUE(Filesystem::DeleteFile(path)); | 85 EXPECT_TRUE(Filesystem::DeleteFile(path)); |
84 } | 86 } |
85 | 87 |
86 // Test checking for free disk space. | 88 // Test checking for free disk space. |
87 TEST(FilesystemTest, TestGetDiskFreeSpace) { | 89 TEST(FilesystemTest, TestGetDiskFreeSpace) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 124 } |
123 | 125 |
124 // Tests that GetAppPathname returns something. | 126 // Tests that GetAppPathname returns something. |
125 TEST(FilesystemTest, TestGetAppPathname) { | 127 TEST(FilesystemTest, TestGetAppPathname) { |
126 Pathname path; | 128 Pathname path; |
127 EXPECT_TRUE(Filesystem::GetAppPathname(&path)); | 129 EXPECT_TRUE(Filesystem::GetAppPathname(&path)); |
128 EXPECT_FALSE(path.empty()); | 130 EXPECT_FALSE(path.empty()); |
129 } | 131 } |
130 | 132 |
131 } // namespace rtc | 133 } // namespace rtc |
OLD | NEW |