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/service.h" |
14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "chromeos/dbus/fake_power_manager_client.h" | 17 #include "chromeos/dbus/fake_power_manager_client.h" |
17 #include "chromeos/disks/disk_mount_manager.h" | 18 #include "chromeos/disks/disk_mount_manager.h" |
18 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 namespace file_manager { | 22 namespace file_manager { |
22 namespace { | 23 namespace { |
23 | 24 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 protected: | 140 protected: |
140 VolumeManagerTest() { | 141 VolumeManagerTest() { |
141 } | 142 } |
142 virtual ~VolumeManagerTest() { | 143 virtual ~VolumeManagerTest() { |
143 } | 144 } |
144 | 145 |
145 virtual void SetUp() OVERRIDE { | 146 virtual void SetUp() OVERRIDE { |
146 power_manager_client_.reset(new chromeos::FakePowerManagerClient); | 147 power_manager_client_.reset(new chromeos::FakePowerManagerClient); |
147 disk_mount_manager_.reset(new FakeDiskMountManager); | 148 disk_mount_manager_.reset(new FakeDiskMountManager); |
148 profile_.reset(new TestingProfile); | 149 profile_.reset(new TestingProfile); |
149 volume_manager_.reset(new VolumeManager(profile_.get(), | 150 file_system_provider_service_.reset( |
150 NULL, // DriveIntegrationService | 151 new chromeos::file_system_provider::Service(profile_.get())); |
151 power_manager_client_.get(), | 152 volume_manager_.reset( |
152 disk_mount_manager_.get())); | 153 new VolumeManager(profile_.get(), |
| 154 NULL, // DriveIntegrationService |
| 155 power_manager_client_.get(), |
| 156 disk_mount_manager_.get(), |
| 157 file_system_provider_service_.get())); |
153 } | 158 } |
154 | 159 |
155 content::TestBrowserThreadBundle thread_bundle_; | 160 content::TestBrowserThreadBundle thread_bundle_; |
156 scoped_ptr<chromeos::FakePowerManagerClient> power_manager_client_; | 161 scoped_ptr<chromeos::FakePowerManagerClient> power_manager_client_; |
157 scoped_ptr<FakeDiskMountManager> disk_mount_manager_; | 162 scoped_ptr<FakeDiskMountManager> disk_mount_manager_; |
158 scoped_ptr<TestingProfile> profile_; | 163 scoped_ptr<TestingProfile> profile_; |
| 164 scoped_ptr<chromeos::file_system_provider::Service> |
| 165 file_system_provider_service_; |
159 scoped_ptr<VolumeManager> volume_manager_; | 166 scoped_ptr<VolumeManager> volume_manager_; |
160 }; | 167 }; |
161 | 168 |
162 TEST_F(VolumeManagerTest, OnDriveFileSystemMountAndUnmount) { | 169 TEST_F(VolumeManagerTest, OnDriveFileSystemMountAndUnmount) { |
163 LoggingObserver observer; | 170 LoggingObserver observer; |
164 volume_manager_->AddObserver(&observer); | 171 volume_manager_->AddObserver(&observer); |
165 | 172 |
166 volume_manager_->OnFileSystemMounted(); | 173 volume_manager_->OnFileSystemMounted(); |
167 | 174 |
168 ASSERT_EQ(1U, observer.events().size()); | 175 ASSERT_EQ(1U, observer.events().size()); |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 chromeos::disks::DiskMountManager::MountPointInfo( | 737 chromeos::disks::DiskMountManager::MountPointInfo( |
731 "/other/profile/drive/folder/3.zip", | 738 "/other/profile/drive/folder/3.zip", |
732 "/archive/3", | 739 "/archive/3", |
733 chromeos::MOUNT_TYPE_ARCHIVE, | 740 chromeos::MOUNT_TYPE_ARCHIVE, |
734 chromeos::disks::MOUNT_CONDITION_NONE)); | 741 chromeos::disks::MOUNT_CONDITION_NONE)); |
735 EXPECT_FALSE(volume_manager_->FindVolumeInfoById("archive:3", &volume_info)); | 742 EXPECT_FALSE(volume_manager_->FindVolumeInfoById("archive:3", &volume_info)); |
736 EXPECT_EQ(3u, observer.events().size()); | 743 EXPECT_EQ(3u, observer.events().size()); |
737 } | 744 } |
738 | 745 |
739 } // namespace file_manager | 746 } // namespace file_manager |
OLD | NEW |