OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 TEST(ChromeOSFileSystemBackendTest, DefaultMountPoints) { | 34 TEST(ChromeOSFileSystemBackendTest, DefaultMountPoints) { |
35 // Make sure no system-level mount points are registered before testing | 35 // Make sure no system-level mount points are registered before testing |
36 // to avoid flakiness. | 36 // to avoid flakiness. |
37 fileapi::ExternalMountPoints::GetSystemInstance()->RevokeAllFileSystems(); | 37 fileapi::ExternalMountPoints::GetSystemInstance()->RevokeAllFileSystems(); |
38 | 38 |
39 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 39 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
40 new quota::MockSpecialStoragePolicy(); | 40 new quota::MockSpecialStoragePolicy(); |
41 scoped_refptr<fileapi::ExternalMountPoints> mount_points( | 41 scoped_refptr<fileapi::ExternalMountPoints> mount_points( |
42 fileapi::ExternalMountPoints::CreateRefCounted()); | 42 fileapi::ExternalMountPoints::CreateRefCounted()); |
43 chromeos::FileSystemBackend backend( | 43 chromeos::FileSystemBackend backend( |
44 base::FilePath(), // profile_path, | |
45 NULL, // media_task_runner, | |
mtomasz
2014/04/23 12:17:19
There seem to be no media_task_runner argument in
kinaba
2014/04/24 01:33:30
Oops. Done.
| |
44 NULL, // drive_delegate | 46 NULL, // drive_delegate |
45 NULL, // file_system_provider_delegate | 47 NULL, // file_system_provider_delegate |
46 storage_policy, | 48 storage_policy, |
47 mount_points.get(), | 49 mount_points.get(), |
48 fileapi::ExternalMountPoints::GetSystemInstance()); | 50 fileapi::ExternalMountPoints::GetSystemInstance()); |
49 backend.AddSystemMountPoints(); | 51 backend.AddSystemMountPoints(); |
50 std::vector<base::FilePath> root_dirs = backend.GetRootDirectories(); | 52 std::vector<base::FilePath> root_dirs = backend.GetRootDirectories(); |
51 std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end()); | 53 std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end()); |
52 | 54 |
53 // By default there should be 3 mount points (in system mount points): | 55 // By default there should be 3 mount points (in system mount points): |
54 EXPECT_EQ(3u, root_dirs.size()); | 56 EXPECT_EQ(3u, root_dirs.size()); |
55 | 57 |
56 EXPECT_TRUE(root_dirs_set.count( | 58 EXPECT_TRUE(root_dirs_set.count( |
57 chromeos::CrosDisksClient::GetRemovableDiskMountPoint())); | 59 chromeos::CrosDisksClient::GetRemovableDiskMountPoint())); |
58 EXPECT_TRUE(root_dirs_set.count( | 60 EXPECT_TRUE(root_dirs_set.count( |
59 chromeos::CrosDisksClient::GetArchiveMountPoint())); | 61 chromeos::CrosDisksClient::GetArchiveMountPoint())); |
60 EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/usr/share/oem")))); | 62 EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/usr/share/oem")))); |
61 } | 63 } |
62 | 64 |
63 TEST(ChromeOSFileSystemBackendTest, GetRootDirectories) { | 65 TEST(ChromeOSFileSystemBackendTest, GetRootDirectories) { |
64 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 66 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
65 new quota::MockSpecialStoragePolicy(); | 67 new quota::MockSpecialStoragePolicy(); |
66 scoped_refptr<fileapi::ExternalMountPoints> mount_points( | 68 scoped_refptr<fileapi::ExternalMountPoints> mount_points( |
67 fileapi::ExternalMountPoints::CreateRefCounted()); | 69 fileapi::ExternalMountPoints::CreateRefCounted()); |
68 | 70 |
69 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( | 71 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( |
70 fileapi::ExternalMountPoints::CreateRefCounted()); | 72 fileapi::ExternalMountPoints::CreateRefCounted()); |
71 | 73 |
72 chromeos::FileSystemBackend backend(NULL, // drive_delegate | 74 chromeos::FileSystemBackend backend(base::FilePath(), // profile_path |
75 NULL, // media_task_runner, | |
76 NULL, // drive_delegate | |
73 NULL, // file_system_provider_delegate | 77 NULL, // file_system_provider_delegate |
74 storage_policy, | 78 storage_policy, |
75 mount_points.get(), | 79 mount_points.get(), |
76 system_mount_points.get()); | 80 system_mount_points.get()); |
77 | 81 |
78 const size_t initial_root_dirs_size = backend.GetRootDirectories().size(); | 82 const size_t initial_root_dirs_size = backend.GetRootDirectories().size(); |
79 | 83 |
80 // Register 'local' test mount points. | 84 // Register 'local' test mount points. |
81 mount_points->RegisterFileSystem("c", | 85 mount_points->RegisterFileSystem("c", |
82 fileapi::kFileSystemTypeNativeLocal, | 86 fileapi::kFileSystemTypeNativeLocal, |
(...skipping 25 matching lines...) Expand all Loading... | |
108 | 112 |
109 TEST(ChromeOSFileSystemBackendTest, AccessPermissions) { | 113 TEST(ChromeOSFileSystemBackendTest, AccessPermissions) { |
110 url_util::AddStandardScheme("chrome-extension"); | 114 url_util::AddStandardScheme("chrome-extension"); |
111 | 115 |
112 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = | 116 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = |
113 new quota::MockSpecialStoragePolicy(); | 117 new quota::MockSpecialStoragePolicy(); |
114 scoped_refptr<fileapi::ExternalMountPoints> mount_points( | 118 scoped_refptr<fileapi::ExternalMountPoints> mount_points( |
115 fileapi::ExternalMountPoints::CreateRefCounted()); | 119 fileapi::ExternalMountPoints::CreateRefCounted()); |
116 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( | 120 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( |
117 fileapi::ExternalMountPoints::CreateRefCounted()); | 121 fileapi::ExternalMountPoints::CreateRefCounted()); |
118 chromeos::FileSystemBackend backend(NULL, // drive_delegate | 122 chromeos::FileSystemBackend backend(base::FilePath(), |
123 NULL, | |
124 NULL, // drive_delegate | |
119 NULL, // file_system_provider_delegate | 125 NULL, // file_system_provider_delegate |
120 storage_policy, | 126 storage_policy, |
121 mount_points.get(), | 127 mount_points.get(), |
122 system_mount_points.get()); | 128 system_mount_points.get()); |
123 | 129 |
124 std::string extension("ddammdhioacbehjngdmkjcjbnfginlla"); | 130 std::string extension("ddammdhioacbehjngdmkjcjbnfginlla"); |
125 | 131 |
126 storage_policy->AddFileHandler(extension); | 132 storage_policy->AddFileHandler(extension); |
127 | 133 |
128 // Initialize mount points. | 134 // Initialize mount points. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); | 207 CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); |
202 } | 208 } |
203 | 209 |
204 TEST(ChromeOSFileSystemBackendTest, GetVirtualPathConflictWithSystemPoints) { | 210 TEST(ChromeOSFileSystemBackendTest, GetVirtualPathConflictWithSystemPoints) { |
205 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = | 211 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = |
206 new quota::MockSpecialStoragePolicy(); | 212 new quota::MockSpecialStoragePolicy(); |
207 scoped_refptr<fileapi::ExternalMountPoints> mount_points( | 213 scoped_refptr<fileapi::ExternalMountPoints> mount_points( |
208 fileapi::ExternalMountPoints::CreateRefCounted()); | 214 fileapi::ExternalMountPoints::CreateRefCounted()); |
209 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( | 215 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( |
210 fileapi::ExternalMountPoints::CreateRefCounted()); | 216 fileapi::ExternalMountPoints::CreateRefCounted()); |
211 chromeos::FileSystemBackend backend(NULL, // drive_delegate | 217 chromeos::FileSystemBackend backend(base::FilePath(), |
218 NULL, | |
219 NULL, // drive_delegate | |
mtomasz
2014/04/23 12:17:19
optional: This is just an idea, but how about maki
kinaba
2014/04/24 01:33:30
Done.
| |
212 NULL, // file_system_provider_delegate | 220 NULL, // file_system_provider_delegate |
213 storage_policy, | 221 storage_policy, |
214 mount_points.get(), | 222 mount_points.get(), |
215 system_mount_points.get()); | 223 system_mount_points.get()); |
216 | 224 |
217 const fileapi::FileSystemType type = fileapi::kFileSystemTypeNativeLocal; | 225 const fileapi::FileSystemType type = fileapi::kFileSystemTypeNativeLocal; |
218 const fileapi::FileSystemMountOption option = | 226 const fileapi::FileSystemMountOption option = |
219 fileapi::FileSystemMountOption(); | 227 fileapi::FileSystemMountOption(); |
220 | 228 |
221 // Backend specific mount points. | 229 // Backend specific mount points. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 if (!kTestCases[i].success) | 275 if (!kTestCases[i].success) |
268 continue; | 276 continue; |
269 | 277 |
270 base::FilePath expected_virtual_path(kTestCases[i].virtual_path); | 278 base::FilePath expected_virtual_path(kTestCases[i].virtual_path); |
271 EXPECT_EQ(expected_virtual_path, virtual_path) | 279 EXPECT_EQ(expected_virtual_path, virtual_path) |
272 << "Resolving " << kTestCases[i].local_path; | 280 << "Resolving " << kTestCases[i].local_path; |
273 } | 281 } |
274 } | 282 } |
275 | 283 |
276 } // namespace | 284 } // namespace |
OLD | NEW |