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/extensions/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // FileSystemApiTestForDrive doesn't expect that several user profiles could | 153 // FileSystemApiTestForDrive doesn't expect that several user profiles could |
154 // exist simultaneously. | 154 // exist simultaneously. |
155 DCHECK(fake_drive_service_ == NULL); | 155 DCHECK(fake_drive_service_ == NULL); |
156 fake_drive_service_ = new drive::FakeDriveService; | 156 fake_drive_service_ = new drive::FakeDriveService; |
157 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 157 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
158 | 158 |
159 SetUpTestFileHierarchy(); | 159 SetUpTestFileHierarchy(); |
160 | 160 |
161 integration_service_ = new drive::DriveIntegrationService( | 161 integration_service_ = new drive::DriveIntegrationService( |
162 profile, NULL, fake_drive_service_, std::string(), | 162 profile, NULL, fake_drive_service_, std::string(), |
163 test_cache_root_.path(), NULL); | 163 test_cache_root_.GetPath(), NULL); |
164 return integration_service_; | 164 return integration_service_; |
165 } | 165 } |
166 | 166 |
167 void SetUpTestFileHierarchy() { | 167 void SetUpTestFileHierarchy() { |
168 const std::string root = fake_drive_service_->GetRootResourceId(); | 168 const std::string root = fake_drive_service_->GetRootResourceId(); |
169 ASSERT_TRUE(AddTestFile("open_existing.txt", "Can you see me?", root)); | 169 ASSERT_TRUE(AddTestFile("open_existing.txt", "Can you see me?", root)); |
170 ASSERT_TRUE(AddTestFile("open_existing1.txt", "Can you see me?", root)); | 170 ASSERT_TRUE(AddTestFile("open_existing1.txt", "Can you see me?", root)); |
171 ASSERT_TRUE(AddTestFile("open_existing2.txt", "Can you see me?", root)); | 171 ASSERT_TRUE(AddTestFile("open_existing2.txt", "Can you see me?", root)); |
172 ASSERT_TRUE(AddTestFile("save_existing.txt", "Can you see me?", root)); | 172 ASSERT_TRUE(AddTestFile("save_existing.txt", "Can you see me?", root)); |
173 const std::string subdir = AddTestDirectory("subdir", root); | 173 const std::string subdir = AddTestDirectory("subdir", root); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 protected: | 238 protected: |
239 base::ScopedTempDir temp_dir_; | 239 base::ScopedTempDir temp_dir_; |
240 chromeos::FakeChromeUserManager* fake_user_manager_; | 240 chromeos::FakeChromeUserManager* fake_user_manager_; |
241 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; | 241 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; |
242 | 242 |
243 // Creates a testing file system in a testing directory. | 243 // Creates a testing file system in a testing directory. |
244 void CreateTestingFileSystem(const std::string& mount_point_name, | 244 void CreateTestingFileSystem(const std::string& mount_point_name, |
245 bool read_only) { | 245 bool read_only) { |
246 const base::FilePath mount_point_path = | 246 const base::FilePath mount_point_path = |
247 temp_dir_.path().Append(mount_point_name); | 247 temp_dir_.GetPath().Append(mount_point_name); |
248 ASSERT_TRUE(base::CreateDirectory(mount_point_path)); | 248 ASSERT_TRUE(base::CreateDirectory(mount_point_path)); |
249 ASSERT_TRUE( | 249 ASSERT_TRUE( |
250 base::CreateDirectory(mount_point_path.Append(kChildDirectory))); | 250 base::CreateDirectory(mount_point_path.Append(kChildDirectory))); |
251 ASSERT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile()) | 251 ASSERT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile()) |
252 ->RegisterFileSystem( | 252 ->RegisterFileSystem( |
253 mount_point_name, storage::kFileSystemTypeNativeLocal, | 253 mount_point_name, storage::kFileSystemTypeNativeLocal, |
254 storage::FileSystemMountOption(), mount_point_path)); | 254 storage::FileSystemMountOption(), mount_point_path)); |
255 VolumeManager* const volume_manager = | 255 VolumeManager* const volume_manager = |
256 VolumeManager::Get(browser()->profile()); | 256 VolumeManager::Get(browser()->profile()); |
257 ASSERT_TRUE(volume_manager); | 257 ASSERT_TRUE(volume_manager); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 profile(), extensions::api::file_system::OnVolumeListChanged::kEventName, | 493 profile(), extensions::api::file_system::OnVolumeListChanged::kEventName, |
494 kTestingExtensionId, | 494 kTestingExtensionId, |
495 base::Bind(&FileSystemApiTestForRequestFileSystem::MountFakeVolume, | 495 base::Bind(&FileSystemApiTestForRequestFileSystem::MountFakeVolume, |
496 base::Unretained(this))); | 496 base::Unretained(this))); |
497 | 497 |
498 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/on_volume_list_changed")) | 498 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/on_volume_list_changed")) |
499 << message_; | 499 << message_; |
500 } | 500 } |
501 | 501 |
502 } // namespace extensions | 502 } // namespace extensions |
OLD | NEW |