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_CROS_MOCK_MOUNT_LIBRARY_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_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/cros/mount_library.h" | |
14 #include "testing/gmock/include/gmock/gmock.h" | |
15 #include "testing/gtest/include/gtest/gtest.h" | |
16 #include "third_party/cros/chromeos_mount.h" | |
17 | |
18 namespace chromeos { | |
19 | |
20 class MockMountLibrary : public MountLibrary { | |
21 public: | |
22 MockMountLibrary(); | |
23 virtual ~MockMountLibrary(); | |
24 | |
25 MOCK_METHOD0(Init, void(void)); | |
26 MOCK_METHOD1(AddObserver, void(MountLibrary::Observer*)); | |
27 MOCK_METHOD1(RemoveObserver, void(MountLibrary::Observer*)); | |
28 MOCK_CONST_METHOD0(disks, const MountLibrary::DiskMap&(void)); | |
29 MOCK_CONST_METHOD0(mount_points, const MountLibrary::MountPointMap&(void)); | |
30 | |
31 MOCK_METHOD0(RequestMountInfoRefresh, void(void)); | |
32 MOCK_METHOD3(MountPath, void(const char*, MountType, | |
33 const MountPathOptions&)); | |
34 MOCK_METHOD1(UnmountPath, void(const char*)); | |
35 MOCK_METHOD3(GetSizeStatsOnFileThread, void(const char*, size_t*, size_t*)); | |
36 MOCK_METHOD1(FormatUnmountedDevice, void(const char*)); | |
37 MOCK_METHOD1(FormatMountedDevice, void(const char*)); | |
38 MOCK_METHOD3(UnmountDeviceRecursive, void(const char*, | |
39 MountLibrary::UnmountDeviceRecursiveCallbackType, void*)); | |
40 | |
41 void FireDeviceInsertEvents(); | |
42 void FireDeviceRemoveEvents(); | |
43 | |
44 void SetupDefaultReplies(); | |
45 | |
46 private: | |
47 void AddObserverInternal(MountLibrary::Observer* observer); | |
48 void RemoveObserverInternal(MountLibrary::Observer* observer); | |
49 const MountLibrary::DiskMap& disksInternal() const { return disks_; } | |
50 | |
51 | |
52 void UpdateDeviceChanged(MountLibraryEventType evt, | |
53 const std::string& path); | |
54 void UpdateDiskChanged(MountLibraryEventType evt, | |
55 const MountLibrary::Disk* disk); | |
56 | |
57 ObserverList<MountLibrary::Observer> observers_; | |
58 | |
59 // The list of disks found. | |
60 MountLibrary::DiskMap disks_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(MockMountLibrary); | |
63 }; | |
64 | |
65 } // namespace chromeos | |
66 | |
67 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_ | |
OLD | NEW |