| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 7 #include <vector> | 
| 8 | 8 | 
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" | 
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" | 
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" | 
|  | 12 #include "base/single_thread_task_runner.h" | 
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" | 
|  | 14 #include "base/thread_task_runner_handle.h" | 
| 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 
| 14 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" | 
| 15 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" | 
| 16 #include "chrome/test/base/testing_profile_manager.h" | 18 #include "chrome/test/base/testing_profile_manager.h" | 
| 17 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" | 
| 18 #include "content/public/test/test_file_system_options.h" | 20 #include "content/public/test/test_file_system_options.h" | 
| 19 #include "google_apis/drive/test_util.h" | 21 #include "google_apis/drive/test_util.h" | 
| 20 #include "storage/browser/fileapi/external_mount_points.h" | 22 #include "storage/browser/fileapi/external_mount_points.h" | 
| 21 #include "storage/browser/fileapi/file_system_backend.h" | 23 #include "storage/browser/fileapi/file_system_backend.h" | 
| 22 #include "storage/browser/fileapi/file_system_context.h" | 24 #include "storage/browser/fileapi/file_system_context.h" | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 124   TestingProfile profile; | 126   TestingProfile profile; | 
| 125 | 127 | 
| 126   // Set up file system context for testing. | 128   // Set up file system context for testing. | 
| 127   base::ScopedTempDir temp_dir_; | 129   base::ScopedTempDir temp_dir_; | 
| 128   ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 130   ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 
| 129 | 131 | 
| 130   scoped_refptr<storage::ExternalMountPoints> mount_points = | 132   scoped_refptr<storage::ExternalMountPoints> mount_points = | 
| 131       storage::ExternalMountPoints::CreateRefCounted(); | 133       storage::ExternalMountPoints::CreateRefCounted(); | 
| 132   scoped_refptr<storage::FileSystemContext> context( | 134   scoped_refptr<storage::FileSystemContext> context( | 
| 133       new storage::FileSystemContext( | 135       new storage::FileSystemContext( | 
| 134           base::MessageLoopProxy::current().get(), | 136           base::ThreadTaskRunnerHandle::Get(), | 
| 135           base::MessageLoopProxy::current().get(), | 137           base::ThreadTaskRunnerHandle::Get(), mount_points.get(), | 
| 136           mount_points.get(), |  | 
| 137           NULL,  // special_storage_policy | 138           NULL,  // special_storage_policy | 
| 138           NULL,  // quota_manager_proxy, | 139           NULL,  // quota_manager_proxy, | 
| 139           ScopedVector<storage::FileSystemBackend>(), | 140           ScopedVector<storage::FileSystemBackend>(), | 
| 140           std::vector<storage::URLRequestAutoMountHandler>(), | 141           std::vector<storage::URLRequestAutoMountHandler>(), | 
| 141           temp_dir_.path(),  // partition_path | 142           temp_dir_.path(),  // partition_path | 
| 142           content::CreateAllowFileAccessOptions())); | 143           content::CreateAllowFileAccessOptions())); | 
| 143 | 144 | 
| 144   // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". | 145   // Type:"external" + virtual_path:"drive/foo/bar" resolves to "drive/foo/bar". | 
| 145   const std::string& drive_mount_name = | 146   const std::string& drive_mount_name = | 
| 146       GetDriveMountPointPath(&profile).BaseName().AsUTF8Unsafe(); | 147       GetDriveMountPointPath(&profile).BaseName().AsUTF8Unsafe(); | 
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 263   // Non GDoc file. | 264   // Non GDoc file. | 
| 264   file = temp_dir.path().AppendASCII("test.txt"); | 265   file = temp_dir.path().AppendASCII("test.txt"); | 
| 265   std::string data = "Hello world!"; | 266   std::string data = "Hello world!"; | 
| 266   EXPECT_TRUE(google_apis::test_util::WriteStringToFile(file, data)); | 267   EXPECT_TRUE(google_apis::test_util::WriteStringToFile(file, data)); | 
| 267   EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); | 268   EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); | 
| 268   EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); | 269   EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); | 
| 269 } | 270 } | 
| 270 | 271 | 
| 271 }  // namespace util | 272 }  // namespace util | 
| 272 }  // namespace drive | 273 }  // namespace drive | 
| OLD | NEW | 
|---|