Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/file_manager/volume_manager.h" | 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" | 12 #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" |
| 13 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" | 13 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" |
| 14 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h" | |
| 14 #include "chrome/browser/chromeos/file_system_provider/service.h" | 15 #include "chrome/browser/chromeos/file_system_provider/service.h" |
| 15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 17 #include "chromeos/dbus/fake_power_manager_client.h" | 18 #include "chromeos/dbus/fake_power_manager_client.h" |
| 18 #include "chromeos/disks/disk_mount_manager.h" | 19 #include "chromeos/disks/disk_mount_manager.h" |
| 19 #include "content/public/test/test_browser_thread_bundle.h" | 20 #include "content/public/test/test_browser_thread_bundle.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| 22 namespace file_manager { | 23 namespace file_manager { |
| 23 namespace { | 24 namespace { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 class VolumeManagerTest : public testing::Test { | 140 class VolumeManagerTest : public testing::Test { |
| 140 protected: | 141 protected: |
| 141 // Helper class that contains per-profile objects. | 142 // Helper class that contains per-profile objects. |
| 142 class ProfileEnvironment { | 143 class ProfileEnvironment { |
| 143 public: | 144 public: |
| 144 ProfileEnvironment(chromeos::PowerManagerClient* power_manager_client, | 145 ProfileEnvironment(chromeos::PowerManagerClient* power_manager_client, |
| 145 chromeos::disks::DiskMountManager* disk_manager) | 146 chromeos::disks::DiskMountManager* disk_manager) |
| 146 : profile_(new TestingProfile), | 147 : profile_(new TestingProfile), |
| 147 file_system_provider_service_( | 148 file_system_provider_service_( |
| 148 new chromeos::file_system_provider::Service(profile_.get())), | 149 new chromeos::file_system_provider::Service(profile_.get())), |
| 149 volume_manager_(new VolumeManager( | 150 volume_manager_( |
| 150 profile_.get(), | 151 new VolumeManager(profile_.get(), |
| 151 NULL, // DriveIntegrationService | 152 NULL, // DriveIntegrationService |
| 152 power_manager_client, | 153 power_manager_client, |
| 153 disk_manager, | 154 disk_manager, |
| 154 file_system_provider_service_.get())) { | 155 file_system_provider_service_.get())) { |
| 156 file_system_provider_service_->SetFileSystemFactoryForTests(base::Bind( | |
| 157 chromeos::file_system_provider::FakeProvidedFileSystem::Create)); | |
|
hashimoto
2014/04/15 13:42:00
nit: '&' can be omitted here, but we usually add '
mtomasz
2014/04/16 01:04:04
Done.
| |
| 155 } | 158 } |
| 156 | 159 |
| 157 Profile* profile() const { return profile_.get(); } | 160 Profile* profile() const { return profile_.get(); } |
| 158 VolumeManager* volume_manager() const { return volume_manager_.get(); } | 161 VolumeManager* volume_manager() const { return volume_manager_.get(); } |
| 159 | 162 |
| 160 private: | 163 private: |
| 161 scoped_ptr<TestingProfile> profile_; | 164 scoped_ptr<TestingProfile> profile_; |
| 162 scoped_ptr<chromeos::file_system_provider::Service> | 165 scoped_ptr<chromeos::file_system_provider::Service> |
| 163 file_system_provider_service_; | 166 file_system_provider_service_; |
| 164 scoped_ptr<VolumeManager> volume_manager_; | 167 scoped_ptr<VolumeManager> volume_manager_; |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 chromeos::disks::DiskMountManager::MountPointInfo( | 803 chromeos::disks::DiskMountManager::MountPointInfo( |
| 801 "/other/profile/drive/folder/3.zip", | 804 "/other/profile/drive/folder/3.zip", |
| 802 "/archive/3", | 805 "/archive/3", |
| 803 chromeos::MOUNT_TYPE_ARCHIVE, | 806 chromeos::MOUNT_TYPE_ARCHIVE, |
| 804 chromeos::disks::MOUNT_CONDITION_NONE)); | 807 chromeos::disks::MOUNT_CONDITION_NONE)); |
| 805 EXPECT_FALSE(volume_manager()->FindVolumeInfoById("archive:3", &volume_info)); | 808 EXPECT_FALSE(volume_manager()->FindVolumeInfoById("archive:3", &volume_info)); |
| 806 EXPECT_EQ(3u, observer.events().size()); | 809 EXPECT_EQ(3u, observer.events().size()); |
| 807 } | 810 } |
| 808 | 811 |
| 809 } // namespace file_manager | 812 } // namespace file_manager |
| OLD | NEW |