Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/chromeos/disks/mock_disk_mount_manager.h

Issue 10874067: chromeos: Move src/chrome/browser/chromeos/disks to src/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
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
8 #include <string>
9
10 #include "base/observer_list.h"
11 #include "base/time.h"
12 #include "chrome/browser/chromeos/disks/disk_mount_manager.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace chromeos {
17 namespace disks {
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_METHOD1(FindDiskBySourcePath,
30 const DiskMountManager::Disk*(const std::string&));
31 MOCK_CONST_METHOD0(mount_points,
32 const DiskMountManager::MountPointMap&(void));
33 MOCK_METHOD0(RequestMountInfoRefresh, void(void));
34 MOCK_METHOD4(MountPath, void(const std::string&, const std::string&,
35 const std::string&, MountType));
36 MOCK_METHOD1(UnmountPath, void(const std::string&));
37 MOCK_METHOD3(GetSizeStatsOnFileThread, void(const std::string&, size_t*,
38 size_t*));
39 MOCK_METHOD1(FormatUnmountedDevice, void(const std::string&));
40 MOCK_METHOD1(FormatMountedDevice, void(const std::string&));
41 MOCK_METHOD3(UnmountDeviceRecursive, void(const std::string&,
42 DiskMountManager::UnmountDeviceRecursiveCallbackType, void*));
43
44 // Invokes fake device insert events.
45 void NotifyDeviceInsertEvents();
46
47 // Invokes fake device remove events.
48 void NotifyDeviceRemoveEvents();
49
50 // Sets up default results for mock methods.
51 void SetupDefaultReplies();
52
53 // Creates a fake disk entry for the mounted device. This function is
54 // primarily for MediaDeviceNotificationsTest.
55 void CreateDiskEntryForMountDevice(
56 const DiskMountManager::MountPointInfo& mount_info,
57 const std::string& device_id);
58
59 // Removes the fake disk entry associated with the mounted device. This
60 // function is primarily for MediaDeviceNotificationsTest.
61 void RemoveDiskEntryForMountDevice(
62 const DiskMountManager::MountPointInfo& mount_info);
63
64 private:
65 // Is used to implement AddObserver.
66 void AddObserverInternal(DiskMountManager::Observer* observer);
67
68 // Is used to implement RemoveObserver.
69 void RemoveObserverInternal(DiskMountManager::Observer* observer);
70
71 // Is used to implement disks.
72 const DiskMountManager::DiskMap& disksInternal() const { return disks_; }
73
74 const DiskMountManager::MountPointMap& mountPointsInternal() const;
75
76 // Returns Disk object associated with the |source_path| or NULL on failure.
77 const DiskMountManager::Disk* FindDiskBySourcePathInternal(
78 const std::string& source_path) const;
79
80 // Notifies observers about device status update.
81 void NotifyDeviceChanged(DiskMountManagerEventType event,
82 const std::string& path);
83
84 // Notifies observers about disk status update.
85 void NotifyDiskChanged(DiskMountManagerEventType event,
86 const DiskMountManager::Disk* disk);
87
88 // The list of observers.
89 ObserverList<DiskMountManager::Observer> observers_;
90
91 // The list of disks found.
92 DiskMountManager::DiskMap disks_;
93
94 // The list of existing mount points.
95 DiskMountManager::MountPointMap mount_points_;
96
97 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager);
98 };
99
100 } // namespace disks
101 } // namespace chromeos
102
103 #endif // CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/disks/disk_mount_manager.cc ('k') | chrome/browser/chromeos/disks/mock_disk_mount_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698