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 |
| 19 class MockDiskMountManager : public DiskMountManager { |
| 20 public: |
| 21 MockDiskMountManager(); |
| 22 virtual ~MockDiskMountManager(); |
| 23 |
| 24 // DiskMountManager override. |
| 25 MOCK_METHOD0(Init, void(void)); |
| 26 MOCK_METHOD1(AddObserver, void(DiskMountManager::Observer*)); |
| 27 MOCK_METHOD1(RemoveObserver, void(DiskMountManager::Observer*)); |
| 28 MOCK_CONST_METHOD0(disks, const DiskMountManager::DiskMap&(void)); |
| 29 MOCK_CONST_METHOD0(mount_points, |
| 30 const DiskMountManager::MountPointMap&(void)); |
| 31 MOCK_METHOD0(RequestMountInfoRefresh, void(void)); |
| 32 MOCK_METHOD2(MountPath, void(const std::string&, MountType)); |
| 33 MOCK_METHOD1(UnmountPath, void(const std::string&)); |
| 34 MOCK_METHOD3(GetSizeStatsOnFileThread, void(const std::string&, size_t*, |
| 35 size_t*)); |
| 36 MOCK_METHOD1(FormatUnmountedDevice, void(const std::string&)); |
| 37 MOCK_METHOD1(FormatMountedDevice, void(const std::string&)); |
| 38 MOCK_METHOD3(UnmountDeviceRecursive, void(const std::string&, |
| 39 DiskMountManager::UnmountDeviceRecursiveCallbackType, void*)); |
| 40 |
| 41 // Invokes fake device insert events. |
| 42 void NotifyDeviceInsertEvents(); |
| 43 |
| 44 // Invokes fake device remove events. |
| 45 void NotifyDeviceRemoveEvents(); |
| 46 |
| 47 // Sets up default results for mock methods. |
| 48 void SetupDefaultReplies(); |
| 49 |
| 50 private: |
| 51 // Is used to implement AddObserver. |
| 52 void AddObserverInternal(DiskMountManager::Observer* observer); |
| 53 |
| 54 // Is used to implement RemoveObserver. |
| 55 void RemoveObserverInternal(DiskMountManager::Observer* observer); |
| 56 |
| 57 // Is used to implement disks. |
| 58 const DiskMountManager::DiskMap& disksInternal() const { return disks_; } |
| 59 |
| 60 // Notifies observers about device status update. |
| 61 void NotifyDeviceChanged(DiskMountManagerEventType event, |
| 62 const std::string& path); |
| 63 |
| 64 // Notifies observers about disk status update. |
| 65 void NotifyDiskChanged(DiskMountManagerEventType event, |
| 66 const DiskMountManager::Disk* disk); |
| 67 |
| 68 // The list of observers. |
| 69 ObserverList<DiskMountManager::Observer> observers_; |
| 70 |
| 71 // The list of disks found. |
| 72 DiskMountManager::DiskMap disks_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); |
| 75 }; |
| 76 |
| 77 } // namespace chromeos |
| 78 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ |
OLD | NEW |