Chromium Code Reviews| 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 #ifndef CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ | 5 #ifndef CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| 6 #define CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ | 6 #define CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chromeos/dbus/cros_disks_client.h" | 14 #include "chromeos/dbus/cros_disks_client.h" |
| 15 #include "chromeos/disks/disk_mount_manager.h" | 15 #include "chromeos/disks/disk_mount_manager.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 namespace disks { | 20 namespace disks { |
| 21 | 21 |
| 22 // TODO(tbarzic): Replace this mock with a fake implementation | 22 // TODO(tbarzic): Replace this mock with a fake implementation |
| 23 // (http://crbug.com/355757) | 23 // (http://crbug.com/355757) |
|
satorux1
2016/10/31 05:36:00
just a suggestion: this may be a good cleanup work
yamaguchi
2016/11/02 07:29:51
Agreed. I'll do it in a spared time.
| |
| 24 class MockDiskMountManager : public DiskMountManager { | 24 class MockDiskMountManager : public DiskMountManager { |
| 25 public: | 25 public: |
| 26 MockDiskMountManager(); | 26 MockDiskMountManager(); |
| 27 virtual ~MockDiskMountManager(); | 27 virtual ~MockDiskMountManager(); |
| 28 | 28 |
| 29 // DiskMountManager override. | 29 // DiskMountManager override. |
| 30 MOCK_METHOD0(Init, void(void)); | 30 MOCK_METHOD0(Init, void(void)); |
| 31 MOCK_METHOD1(AddObserver, void(DiskMountManager::Observer*)); | 31 MOCK_METHOD1(AddObserver, void(DiskMountManager::Observer*)); |
| 32 MOCK_METHOD1(RemoveObserver, void(DiskMountManager::Observer*)); | 32 MOCK_METHOD1(RemoveObserver, void(DiskMountManager::Observer*)); |
| 33 MOCK_CONST_METHOD0(disks, const DiskMountManager::DiskMap&(void)); | 33 MOCK_CONST_METHOD0(disks, const DiskMountManager::DiskMap&(void)); |
| 34 MOCK_CONST_METHOD1(FindDiskBySourcePath, | 34 MOCK_CONST_METHOD1(FindDiskBySourcePath, |
| 35 const DiskMountManager::Disk*(const std::string&)); | 35 const DiskMountManager::Disk*(const std::string&)); |
| 36 MOCK_CONST_METHOD0(mount_points, | 36 MOCK_CONST_METHOD0(mount_points, |
| 37 const DiskMountManager::MountPointMap&(void)); | 37 const DiskMountManager::MountPointMap&(void)); |
| 38 MOCK_METHOD2(EnsureMountInfoRefreshed, | 38 MOCK_METHOD2(EnsureMountInfoRefreshed, |
| 39 void(const EnsureMountInfoRefreshedCallback&, bool)); | 39 void(const EnsureMountInfoRefreshedCallback&, bool)); |
| 40 MOCK_METHOD5(MountPath, | 40 MOCK_METHOD5(MountPath, |
| 41 void(const std::string&, | 41 void(const std::string&, |
| 42 const std::string&, | 42 const std::string&, |
| 43 const std::string&, | 43 const std::string&, |
| 44 MountType, | 44 MountType, |
| 45 MountAccessMode)); | 45 MountAccessMode)); |
| 46 MOCK_METHOD3(UnmountPath, void(const std::string&, | 46 MOCK_METHOD3(UnmountPath, void(const std::string&, |
| 47 UnmountOptions, | 47 UnmountOptions, |
| 48 const DiskMountManager::UnmountPathCallback&)); | 48 const DiskMountManager::UnmountPathCallback&)); |
| 49 MOCK_METHOD1(RemountAllRemovableDrives, void(MountAccessMode)); | |
| 49 MOCK_METHOD1(FormatMountedDevice, void(const std::string&)); | 50 MOCK_METHOD1(FormatMountedDevice, void(const std::string&)); |
| 50 MOCK_METHOD2( | 51 MOCK_METHOD2( |
| 51 UnmountDeviceRecursively, | 52 UnmountDeviceRecursively, |
| 52 void(const std::string&, | 53 void(const std::string&, |
| 53 const DiskMountManager::UnmountDeviceRecursivelyCallbackType&)); | 54 const DiskMountManager::UnmountDeviceRecursivelyCallbackType&)); |
| 54 | 55 |
| 55 // Invokes fake device insert events. | 56 // Invokes fake device insert events. |
| 56 void NotifyDeviceInsertEvents(); | 57 void NotifyDeviceInsertEvents(); |
| 57 | 58 |
| 58 // Invokes fake device remove events. | 59 // Invokes fake device remove events. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 // The list of existing mount points. | 120 // The list of existing mount points. |
| 120 DiskMountManager::MountPointMap mount_points_; | 121 DiskMountManager::MountPointMap mount_points_; |
| 121 | 122 |
| 122 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); | 123 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 } // namespace disks | 126 } // namespace disks |
| 126 } // namespace chromeos | 127 } // namespace chromeos |
| 127 | 128 |
| 128 #endif // CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ | 129 #endif // CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| OLD | NEW |