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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "chromeos/dbus/cros_disks_client.h" | 11 #include "chromeos/dbus/cros_disks_client.h" |
| 12 #include "chromeos/disks/disk_mount_manager.h" | 12 #include "chromeos/disks/disk_mount_manager.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 namespace disks { | 17 namespace disks { |
| 18 | 18 |
|
tbarzic
2014/03/22 02:01:02
can you file a bug against me to replace MockDisak
Drew Haven
2014/03/24 22:33:25
Done.
| |
| 19 class MockDiskMountManager : public DiskMountManager { | 19 class MockDiskMountManager : public DiskMountManager { |
| 20 public: | 20 public: |
| 21 MockDiskMountManager(); | 21 MockDiskMountManager(); |
| 22 virtual ~MockDiskMountManager(); | 22 virtual ~MockDiskMountManager(); |
| 23 | 23 |
| 24 // DiskMountManager override. | 24 // DiskMountManager override. |
| 25 MOCK_METHOD0(Init, void(void)); | 25 MOCK_METHOD0(Init, void(void)); |
| 26 MOCK_METHOD1(AddObserver, void(DiskMountManager::Observer*)); | 26 MOCK_METHOD1(AddObserver, void(DiskMountManager::Observer*)); |
| 27 MOCK_METHOD1(RemoveObserver, void(DiskMountManager::Observer*)); | 27 MOCK_METHOD1(RemoveObserver, void(DiskMountManager::Observer*)); |
| 28 MOCK_CONST_METHOD0(disks, const DiskMountManager::DiskMap&(void)); | 28 MOCK_CONST_METHOD0(disks, const DiskMountManager::DiskMap&(void)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 const std::string& vendor_name, | 60 const std::string& vendor_name, |
| 61 const std::string& product_name, | 61 const std::string& product_name, |
| 62 DeviceType device_type, | 62 DeviceType device_type, |
| 63 uint64 total_size_in_bytes); | 63 uint64 total_size_in_bytes); |
| 64 | 64 |
| 65 // Removes the fake disk entry associated with the mounted device. This | 65 // Removes the fake disk entry associated with the mounted device. This |
| 66 // function is primarily for StorageMonitorTest. | 66 // function is primarily for StorageMonitorTest. |
| 67 void RemoveDiskEntryForMountDevice( | 67 void RemoveDiskEntryForMountDevice( |
| 68 const DiskMountManager::MountPointInfo& mount_info); | 68 const DiskMountManager::MountPointInfo& mount_info); |
| 69 | 69 |
| 70 // Adds a fake disk entry. This takes ownership of the pointer. | |
|
hashimoto
2014/03/24 04:37:09
You should use scoped_ptr instead of having this k
Drew Haven
2014/03/24 22:33:25
Done.
| |
| 71 void AddDiskEntry(Disk* disk); | |
|
tbarzic
2014/03/22 02:01:02
you can use CreateDiskEntryForMountDevice/RemoveDi
hashimoto
2014/03/24 04:37:09
+1
Drew Haven
2014/03/24 22:33:25
The reason I wanted this was because many of the p
tbarzic
2014/03/24 22:48:42
What I had in mind was to change
CreateDiskEntryF
| |
| 72 | |
| 73 // Removes a fake disk entry. This will delete the pointer. | |
| 74 void RemoveDiskEntry(Disk* disk); | |
|
hashimoto
2014/03/24 04:37:09
Why don't you pass device_path to this method?
Drew Haven
2014/03/24 22:33:25
Done.
| |
| 75 | |
| 70 private: | 76 private: |
| 71 // Is used to implement AddObserver. | 77 // Is used to implement AddObserver. |
| 72 void AddObserverInternal(DiskMountManager::Observer* observer); | 78 void AddObserverInternal(DiskMountManager::Observer* observer); |
| 73 | 79 |
| 74 // Is used to implement RemoveObserver. | 80 // Is used to implement RemoveObserver. |
| 75 void RemoveObserverInternal(DiskMountManager::Observer* observer); | 81 void RemoveObserverInternal(DiskMountManager::Observer* observer); |
| 76 | 82 |
| 77 // Is used to implement disks. | 83 // Is used to implement disks. |
| 78 const DiskMountManager::DiskMap& disksInternal() const { return disks_; } | 84 const DiskMountManager::DiskMap& disksInternal() const { return disks_; } |
| 79 | 85 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 100 // The list of existing mount points. | 106 // The list of existing mount points. |
| 101 DiskMountManager::MountPointMap mount_points_; | 107 DiskMountManager::MountPointMap mount_points_; |
| 102 | 108 |
| 103 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); | 109 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); |
| 104 }; | 110 }; |
| 105 | 111 |
| 106 } // namespace disks | 112 } // namespace disks |
| 107 } // namespace chromeos | 113 } // namespace chromeos |
| 108 | 114 |
| 109 #endif // CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ | 115 #endif // CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| OLD | NEW |