| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/google_apis/test_util.h" | 12 #include "chrome/browser/google_apis/test_util.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "webkit/browser/fileapi/external_mount_points.h" | 15 #include "webkit/browser/fileapi/external_mount_points.h" |
| 16 #include "webkit/browser/fileapi/file_system_backend.h" |
| 16 #include "webkit/browser/fileapi/file_system_context.h" | 17 #include "webkit/browser/fileapi/file_system_context.h" |
| 17 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
| 18 #include "webkit/browser/fileapi/file_system_task_runners.h" | 18 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 19 #include "webkit/browser/fileapi/file_system_url.h" | 19 #include "webkit/browser/fileapi/file_system_url.h" |
| 20 #include "webkit/browser/fileapi/isolated_context.h" | 20 #include "webkit/browser/fileapi/isolated_context.h" |
| 21 #include "webkit/browser/fileapi/mock_file_system_options.h" | 21 #include "webkit/browser/fileapi/mock_file_system_options.h" |
| 22 | 22 |
| 23 namespace drive { | 23 namespace drive { |
| 24 namespace util { | 24 namespace util { |
| 25 | 25 |
| 26 TEST(FileSystemUtilTest, FilePathToDriveURL) { | 26 TEST(FileSystemUtilTest, FilePathToDriveURL) { |
| 27 base::FilePath path; | 27 base::FilePath path; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 base::MessageLoop message_loop; | 96 base::MessageLoop message_loop; |
| 97 scoped_refptr<fileapi::ExternalMountPoints> mount_points = | 97 scoped_refptr<fileapi::ExternalMountPoints> mount_points = |
| 98 fileapi::ExternalMountPoints::CreateRefCounted(); | 98 fileapi::ExternalMountPoints::CreateRefCounted(); |
| 99 scoped_refptr<fileapi::FileSystemContext> context( | 99 scoped_refptr<fileapi::FileSystemContext> context( |
| 100 new fileapi::FileSystemContext( | 100 new fileapi::FileSystemContext( |
| 101 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), | 101 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), |
| 102 mount_points.get(), | 102 mount_points.get(), |
| 103 NULL, // special_storage_policy | 103 NULL, // special_storage_policy |
| 104 NULL, // quota_manager_proxy, | 104 NULL, // quota_manager_proxy, |
| 105 ScopedVector<fileapi::FileSystemMountPointProvider>(), | 105 ScopedVector<fileapi::FileSystemBackend>(), |
| 106 temp_dir_.path(), // partition_path | 106 temp_dir_.path(), // partition_path |
| 107 fileapi::CreateAllowFileAccessOptions())); | 107 fileapi::CreateAllowFileAccessOptions())); |
| 108 | 108 |
| 109 // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". | 109 // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". |
| 110 const std::string& drive_mount_name = | 110 const std::string& drive_mount_name = |
| 111 GetDriveMountPointPath().BaseName().AsUTF8Unsafe(); | 111 GetDriveMountPointPath().BaseName().AsUTF8Unsafe(); |
| 112 mount_points->RegisterRemoteFileSystem( | 112 mount_points->RegisterRemoteFileSystem( |
| 113 drive_mount_name, | 113 drive_mount_name, |
| 114 fileapi::kFileSystemTypeDrive, | 114 fileapi::kFileSystemTypeDrive, |
| 115 NULL, // RemoteFileSystemProxyInterface | 115 NULL, // RemoteFileSystemProxyInterface |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 std::string data = "Hello world!"; | 339 std::string data = "Hello world!"; |
| 340 EXPECT_EQ(static_cast<int>(data.size()), | 340 EXPECT_EQ(static_cast<int>(data.size()), |
| 341 file_util::WriteFile(file, data.data(), data.size())); | 341 file_util::WriteFile(file, data.data(), data.size())); |
| 342 EXPECT_FALSE(HasGDocFileExtension(file)); | 342 EXPECT_FALSE(HasGDocFileExtension(file)); |
| 343 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); | 343 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); |
| 344 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); | 344 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace util | 347 } // namespace util |
| 348 } // namespace drive | 348 } // namespace drive |
| OLD | NEW |