OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drive/drive_file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "webkit/fileapi/external_mount_points.h" | 12 #include "webkit/fileapi/external_mount_points.h" |
13 #include "webkit/fileapi/file_system_context.h" | 13 #include "webkit/fileapi/file_system_context.h" |
| 14 #include "webkit/fileapi/file_system_mount_point_provider.h" |
14 #include "webkit/fileapi/file_system_task_runners.h" | 15 #include "webkit/fileapi/file_system_task_runners.h" |
15 #include "webkit/fileapi/file_system_url.h" | 16 #include "webkit/fileapi/file_system_url.h" |
16 #include "webkit/fileapi/isolated_context.h" | 17 #include "webkit/fileapi/isolated_context.h" |
17 #include "webkit/fileapi/mock_file_system_options.h" | 18 #include "webkit/fileapi/mock_file_system_options.h" |
18 | 19 |
19 namespace drive { | 20 namespace drive { |
20 namespace util { | 21 namespace util { |
21 | 22 |
22 TEST(DriveFileSystemUtilTest, FilePathToDriveURL) { | 23 TEST(DriveFileSystemUtilTest, FilePathToDriveURL) { |
23 base::FilePath path; | 24 base::FilePath path; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 92 |
92 MessageLoop message_loop; | 93 MessageLoop message_loop; |
93 scoped_refptr<fileapi::ExternalMountPoints> mount_points = | 94 scoped_refptr<fileapi::ExternalMountPoints> mount_points = |
94 fileapi::ExternalMountPoints::CreateRefCounted(); | 95 fileapi::ExternalMountPoints::CreateRefCounted(); |
95 scoped_refptr<fileapi::FileSystemContext> context( | 96 scoped_refptr<fileapi::FileSystemContext> context( |
96 new fileapi::FileSystemContext( | 97 new fileapi::FileSystemContext( |
97 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), | 98 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), |
98 mount_points, | 99 mount_points, |
99 NULL, // special_storage_policy | 100 NULL, // special_storage_policy |
100 NULL, // quota_manager_proxy, | 101 NULL, // quota_manager_proxy, |
| 102 ScopedVector<fileapi::FileSystemMountPointProvider>(), |
101 temp_dir_.path(), // partition_path | 103 temp_dir_.path(), // partition_path |
102 fileapi::CreateAllowFileAccessOptions())); | 104 fileapi::CreateAllowFileAccessOptions())); |
103 | 105 |
104 // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". | 106 // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". |
105 const std::string& drive_mount_name = | 107 const std::string& drive_mount_name = |
106 GetDriveMountPointPath().BaseName().AsUTF8Unsafe(); | 108 GetDriveMountPointPath().BaseName().AsUTF8Unsafe(); |
107 mount_points->RegisterRemoteFileSystem( | 109 mount_points->RegisterRemoteFileSystem( |
108 drive_mount_name, | 110 drive_mount_name, |
109 fileapi::kFileSystemTypeDrive, | 111 fileapi::kFileSystemTypeDrive, |
110 NULL, // RemoteFileSystemProxyInterface | 112 NULL, // RemoteFileSystemProxyInterface |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 EXPECT_FALSE(util::IsSpecialResourceId("file:123")); | 263 EXPECT_FALSE(util::IsSpecialResourceId("file:123")); |
262 EXPECT_FALSE(util::IsSpecialResourceId("folder:root")); | 264 EXPECT_FALSE(util::IsSpecialResourceId("folder:root")); |
263 EXPECT_FALSE(util::IsSpecialResourceId("folder:xyz")); | 265 EXPECT_FALSE(util::IsSpecialResourceId("folder:xyz")); |
264 | 266 |
265 EXPECT_TRUE(util::IsSpecialResourceId("<drive>")); | 267 EXPECT_TRUE(util::IsSpecialResourceId("<drive>")); |
266 EXPECT_TRUE(util::IsSpecialResourceId("<other>")); | 268 EXPECT_TRUE(util::IsSpecialResourceId("<other>")); |
267 } | 269 } |
268 | 270 |
269 } // namespace util | 271 } // namespace util |
270 } // namespace drive | 272 } // namespace drive |
OLD | NEW |