| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/observer_list.h" |
| 12 #include "base/time.h" |
| 13 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 |
| 17 namespace chromeos { |
| 18 namespace disks { |
| 19 |
| 20 class MockDiskMountManager : public DiskMountManager { |
| 21 public: |
| 22 MockDiskMountManager(); |
| 23 virtual ~MockDiskMountManager(); |
| 24 |
| 25 // DiskMountManager override. |
| 26 MOCK_METHOD0(Init, void(void)); |
| 27 MOCK_METHOD1(AddObserver, void(DiskMountManager::Observer*)); |
| 28 MOCK_METHOD1(RemoveObserver, void(DiskMountManager::Observer*)); |
| 29 MOCK_CONST_METHOD0(disks, const DiskMountManager::DiskMap&(void)); |
| 30 MOCK_CONST_METHOD0(mount_points, |
| 31 const DiskMountManager::MountPointMap&(void)); |
| 32 MOCK_METHOD0(RequestMountInfoRefresh, void(void)); |
| 33 MOCK_METHOD2(MountPath, void(const std::string&, MountType)); |
| 34 MOCK_METHOD1(UnmountPath, void(const std::string&)); |
| 35 MOCK_METHOD3(GetSizeStatsOnFileThread, void(const std::string&, size_t*, |
| 36 size_t*)); |
| 37 MOCK_METHOD1(FormatUnmountedDevice, void(const std::string&)); |
| 38 MOCK_METHOD1(FormatMountedDevice, void(const std::string&)); |
| 39 MOCK_METHOD3(UnmountDeviceRecursive, void(const std::string&, |
| 40 DiskMountManager::UnmountDeviceRecursiveCallbackType, void*)); |
| 41 |
| 42 // Invokes fake device insert events. |
| 43 void NotifyDeviceInsertEvents(); |
| 44 |
| 45 // Invokes fake device remove events. |
| 46 void NotifyDeviceRemoveEvents(); |
| 47 |
| 48 // Sets up default results for mock methods. |
| 49 void SetupDefaultReplies(); |
| 50 |
| 51 private: |
| 52 // Is used to implement AddObserver. |
| 53 void AddObserverInternal(DiskMountManager::Observer* observer); |
| 54 |
| 55 // Is used to implement RemoveObserver. |
| 56 void RemoveObserverInternal(DiskMountManager::Observer* observer); |
| 57 |
| 58 // Is used to implement disks. |
| 59 const DiskMountManager::DiskMap& disksInternal() const { return disks_; } |
| 60 |
| 61 // Notifies observers about device status update. |
| 62 void NotifyDeviceChanged(DiskMountManagerEventType event, |
| 63 const std::string& path); |
| 64 |
| 65 // Notifies observers about disk status update. |
| 66 void NotifyDiskChanged(DiskMountManagerEventType event, |
| 67 const DiskMountManager::Disk* disk); |
| 68 |
| 69 // The list of observers. |
| 70 ObserverList<DiskMountManager::Observer> observers_; |
| 71 |
| 72 // The list of disks found. |
| 73 DiskMountManager::DiskMap disks_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); |
| 76 }; |
| 77 |
| 78 } // namespace disks |
| 79 } // namespace chromeos |
| 80 |
| 81 #endif // CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
| OLD | NEW |