| 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
| 7 #include "chrome/browser/chromeos/drive/file_change.h" | 7 #include "chrome/browser/chromeos/drive/file_change.h" |
| 8 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" | 8 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
| 9 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" | 9 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" |
| 10 #include "chrome/browser/chromeos/file_manager/file_watcher.h" | 10 #include "chrome/browser/chromeos/file_manager/file_watcher.h" |
| 11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
| 11 #include "chrome/browser/extensions/extension_apitest.h" | 12 #include "chrome/browser/extensions/extension_apitest.h" |
| 13 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 13 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
| 14 #include "chromeos/dbus/cros_disks_client.h" | 16 #include "chromeos/dbus/cros_disks_client.h" |
| 15 #include "chromeos/disks/mock_disk_mount_manager.h" | 17 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 16 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 17 #include "extensions/common/install_warning.h" | 19 #include "extensions/common/install_warning.h" |
| 18 #include "google_apis/drive/test_util.h" | 20 #include "google_apis/drive/test_util.h" |
| 19 #include "storage/browser/fileapi/external_mount_points.h" | 21 #include "storage/browser/fileapi/external_mount_points.h" |
| 20 | 22 |
| 21 using ::testing::_; | 23 using ::testing::_; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 DiskMountManager::DiskMap volumes_; | 306 DiskMountManager::DiskMap volumes_; |
| 305 DiskMountManager::MountPointMap mount_points_; | 307 DiskMountManager::MountPointMap mount_points_; |
| 306 scoped_ptr<TestingProfile> testing_profile_; | 308 scoped_ptr<TestingProfile> testing_profile_; |
| 307 scoped_ptr<file_manager::EventRouter> event_router_; | 309 scoped_ptr<file_manager::EventRouter> event_router_; |
| 308 }; | 310 }; |
| 309 | 311 |
| 310 IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, Mount) { | 312 IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, Mount) { |
| 311 file_manager::test_util::WaitUntilDriveMountPointIsAdded( | 313 file_manager::test_util::WaitUntilDriveMountPointIsAdded( |
| 312 browser()->profile()); | 314 browser()->profile()); |
| 313 | 315 |
| 316 // Add a provided file system, to test passing the |configurable| and |
| 317 // |source| flags properly down to Files app. |
| 318 chromeos::file_system_provider::ProvidedFileSystemInfo info( |
| 319 "testing-extension-id", chromeos::file_system_provider::MountOptions(), |
| 320 base::FilePath(), true /* configurable */, extensions::SOURCE_NETWORK); |
| 321 |
| 322 file_manager::VolumeManager::Get(browser()->profile()) |
| 323 ->AddVolumeForTesting( |
| 324 make_linked_ptr(file_manager::Volume::CreateForProvidedFileSystem( |
| 325 info, file_manager::MOUNT_CONTEXT_AUTO))); |
| 326 |
| 314 // We will call fileManagerPrivate.unmountVolume once. To test that method, we | 327 // We will call fileManagerPrivate.unmountVolume once. To test that method, we |
| 315 // check that UnmountPath is really called with the same value. | 328 // check that UnmountPath is really called with the same value. |
| 316 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_, _, _)) | 329 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_, _, _)) |
| 317 .Times(0); | 330 .Times(0); |
| 318 EXPECT_CALL(*disk_mount_manager_mock_, | 331 EXPECT_CALL(*disk_mount_manager_mock_, |
| 319 UnmountPath( | 332 UnmountPath( |
| 320 chromeos::CrosDisksClient::GetArchiveMountPoint().AppendASCII( | 333 chromeos::CrosDisksClient::GetArchiveMountPoint().AppendASCII( |
| 321 "archive_mount_path").AsUTF8Unsafe(), | 334 "archive_mount_path").AsUTF8Unsafe(), |
| 322 chromeos::UNMOUNT_OPTIONS_NONE, _)).Times(1); | 335 chromeos::UNMOUNT_OPTIONS_NONE, _)).Times(1); |
| 323 | 336 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 ->RegisterFileSystem( | 436 ->RegisterFileSystem( |
| 424 kLocalMountPointName, storage::kFileSystemTypeNativeLocal, | 437 kLocalMountPointName, storage::kFileSystemTypeNativeLocal, |
| 425 storage::FileSystemMountOption(), mount_point_dir)); | 438 storage::FileSystemMountOption(), mount_point_dir)); |
| 426 file_manager::VolumeManager::Get(browser()->profile()) | 439 file_manager::VolumeManager::Get(browser()->profile()) |
| 427 ->AddVolumeForTesting(mount_point_dir, file_manager::VOLUME_TYPE_TESTING, | 440 ->AddVolumeForTesting(mount_point_dir, file_manager::VOLUME_TYPE_TESTING, |
| 428 chromeos::DEVICE_TYPE_UNKNOWN, | 441 chromeos::DEVICE_TYPE_UNKNOWN, |
| 429 false /* read_only */); | 442 false /* read_only */); |
| 430 | 443 |
| 431 ASSERT_TRUE(RunComponentExtensionTest("file_browser/content_checksum_test")); | 444 ASSERT_TRUE(RunComponentExtensionTest("file_browser/content_checksum_test")); |
| 432 } | 445 } |
| OLD | NEW |