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/stl_util.h" | 5 #include "base/stl_util.h" |
6 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" | 6 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chromeos/dbus/cros_disks_client.h" | 8 #include "chromeos/dbus/cros_disks_client.h" |
9 #include "chromeos/disks/mock_disk_mount_manager.h" | 9 #include "chromeos/disks/mock_disk_mount_manager.h" |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 // ExtensionApiTest override | 122 // ExtensionApiTest override |
123 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 123 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
124 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 124 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
125 | 125 |
126 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; | 126 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; |
127 chromeos::disks::DiskMountManager::InitializeForTesting( | 127 chromeos::disks::DiskMountManager::InitializeForTesting( |
128 disk_mount_manager_mock_); | 128 disk_mount_manager_mock_); |
129 disk_mount_manager_mock_->SetupDefaultReplies(); | 129 disk_mount_manager_mock_->SetupDefaultReplies(); |
130 | 130 |
131 // OVERRIDE FindDiskBySourcePath mock function. | 131 // OVERRIDE mock functions. |
132 ON_CALL(*disk_mount_manager_mock_, FindDiskBySourcePath(_)). | 132 ON_CALL(*disk_mount_manager_mock_, FindDiskBySourcePath(_)).WillByDefault( |
133 WillByDefault(Invoke( | 133 Invoke(this, &FileBrowserPrivateApiTest::FindVolumeBySourcePath)); |
134 this, &FileBrowserPrivateApiTest::FindVolumeBySourcePath)); | 134 EXPECT_CALL(*disk_mount_manager_mock_, disks()) |
| 135 .WillRepeatedly(ReturnRef(volumes_)); |
| 136 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) |
| 137 .WillRepeatedly(ReturnRef(mount_points_)); |
135 } | 138 } |
136 | 139 |
137 // ExtensionApiTest override | 140 // ExtensionApiTest override |
138 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 141 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
139 chromeos::disks::DiskMountManager::Shutdown(); | 142 chromeos::disks::DiskMountManager::Shutdown(); |
140 disk_mount_manager_mock_ = NULL; | 143 disk_mount_manager_mock_ = NULL; |
141 | 144 |
142 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 145 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
143 } | 146 } |
144 | 147 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // We will call fileBrowserPrivate.unmountVolume once. To test that method, we | 244 // We will call fileBrowserPrivate.unmountVolume once. To test that method, we |
242 // check that UnmountPath is really called with the same value. | 245 // check that UnmountPath is really called with the same value. |
243 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_, _, _)) | 246 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_, _, _)) |
244 .Times(0); | 247 .Times(0); |
245 EXPECT_CALL(*disk_mount_manager_mock_, | 248 EXPECT_CALL(*disk_mount_manager_mock_, |
246 UnmountPath( | 249 UnmountPath( |
247 chromeos::CrosDisksClient::GetArchiveMountPoint().AppendASCII( | 250 chromeos::CrosDisksClient::GetArchiveMountPoint().AppendASCII( |
248 "archive_mount_path").AsUTF8Unsafe(), | 251 "archive_mount_path").AsUTF8Unsafe(), |
249 chromeos::UNMOUNT_OPTIONS_NONE, _)).Times(1); | 252 chromeos::UNMOUNT_OPTIONS_NONE, _)).Times(1); |
250 | 253 |
251 EXPECT_CALL(*disk_mount_manager_mock_, disks()) | |
252 .WillRepeatedly(ReturnRef(volumes_)); | |
253 | |
254 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) | |
255 .WillRepeatedly(ReturnRef(mount_points_)); | |
256 | |
257 ASSERT_TRUE(RunComponentExtensionTest("file_browser/mount_test")) | 254 ASSERT_TRUE(RunComponentExtensionTest("file_browser/mount_test")) |
258 << message_; | 255 << message_; |
259 } | 256 } |
OLD | NEW |