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/file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/file_system_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/google_apis/test_util.h" | 13 #include "chrome/browser/google_apis/test_util.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "webkit/browser/fileapi/external_mount_points.h" | 16 #include "webkit/browser/fileapi/external_mount_points.h" |
| 17 #include "webkit/browser/fileapi/file_system_backend.h" |
17 #include "webkit/browser/fileapi/file_system_context.h" | 18 #include "webkit/browser/fileapi/file_system_context.h" |
18 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
19 #include "webkit/browser/fileapi/file_system_task_runners.h" | 19 #include "webkit/browser/fileapi/file_system_task_runners.h" |
20 #include "webkit/browser/fileapi/file_system_url.h" | 20 #include "webkit/browser/fileapi/file_system_url.h" |
21 #include "webkit/browser/fileapi/isolated_context.h" | 21 #include "webkit/browser/fileapi/isolated_context.h" |
22 #include "webkit/browser/fileapi/mock_file_system_options.h" | 22 #include "webkit/browser/fileapi/mock_file_system_options.h" |
23 | 23 |
24 namespace drive { | 24 namespace drive { |
25 namespace util { | 25 namespace util { |
26 | 26 |
27 TEST(FileSystemUtilTest, FilePathToDriveURL) { | 27 TEST(FileSystemUtilTest, FilePathToDriveURL) { |
28 base::FilePath path; | 28 base::FilePath path; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 base::MessageLoop message_loop; | 97 base::MessageLoop message_loop; |
98 scoped_refptr<fileapi::ExternalMountPoints> mount_points = | 98 scoped_refptr<fileapi::ExternalMountPoints> mount_points = |
99 fileapi::ExternalMountPoints::CreateRefCounted(); | 99 fileapi::ExternalMountPoints::CreateRefCounted(); |
100 scoped_refptr<fileapi::FileSystemContext> context( | 100 scoped_refptr<fileapi::FileSystemContext> context( |
101 new fileapi::FileSystemContext( | 101 new fileapi::FileSystemContext( |
102 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), | 102 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), |
103 mount_points.get(), | 103 mount_points.get(), |
104 NULL, // special_storage_policy | 104 NULL, // special_storage_policy |
105 NULL, // quota_manager_proxy, | 105 NULL, // quota_manager_proxy, |
106 ScopedVector<fileapi::FileSystemMountPointProvider>(), | 106 ScopedVector<fileapi::FileSystemBackend>(), |
107 temp_dir_.path(), // partition_path | 107 temp_dir_.path(), // partition_path |
108 fileapi::CreateAllowFileAccessOptions())); | 108 fileapi::CreateAllowFileAccessOptions())); |
109 | 109 |
110 // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". | 110 // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". |
111 const std::string& drive_mount_name = | 111 const std::string& drive_mount_name = |
112 GetDriveMountPointPath().BaseName().AsUTF8Unsafe(); | 112 GetDriveMountPointPath().BaseName().AsUTF8Unsafe(); |
113 mount_points->RegisterRemoteFileSystem( | 113 mount_points->RegisterRemoteFileSystem( |
114 drive_mount_name, | 114 drive_mount_name, |
115 fileapi::kFileSystemTypeDrive, | 115 fileapi::kFileSystemTypeDrive, |
116 NULL, // RemoteFileSystemProxyInterface | 116 NULL, // RemoteFileSystemProxyInterface |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); | 351 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); |
352 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; | 352 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; |
353 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); | 353 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); |
354 | 354 |
355 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); | 355 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); |
356 } | 356 } |
357 | 357 |
358 } // namespace util | 358 } // namespace util |
359 } // namespace drive | 359 } // namespace drive |
OLD | NEW |