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

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

Issue 10829160: Created a helper function "FindDiskBySourcePath" in DiskMountManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 8 years, 4 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
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 CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ 6 #define CHROME_BROWSER_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 "base/time.h" 11 #include "base/time.h"
12 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" 12 #include "chrome/browser/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
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));
29 MOCK_CONST_METHOD1(FindDiskBySourcePath,
30 const DiskMountManager::Disk*(const std::string&));
29 MOCK_CONST_METHOD0(mount_points, 31 MOCK_CONST_METHOD0(mount_points,
30 const DiskMountManager::MountPointMap&(void)); 32 const DiskMountManager::MountPointMap&(void));
31 MOCK_METHOD0(RequestMountInfoRefresh, void(void)); 33 MOCK_METHOD0(RequestMountInfoRefresh, void(void));
32 MOCK_METHOD4(MountPath, void(const std::string&, const std::string&, 34 MOCK_METHOD4(MountPath, void(const std::string&, const std::string&,
33 const std::string&, MountType)); 35 const std::string&, MountType));
34 MOCK_METHOD1(UnmountPath, void(const std::string&)); 36 MOCK_METHOD1(UnmountPath, void(const std::string&));
35 MOCK_METHOD3(GetSizeStatsOnFileThread, void(const std::string&, size_t*, 37 MOCK_METHOD3(GetSizeStatsOnFileThread, void(const std::string&, size_t*,
36 size_t*)); 38 size_t*));
37 MOCK_METHOD1(FormatUnmountedDevice, void(const std::string&)); 39 MOCK_METHOD1(FormatUnmountedDevice, void(const std::string&));
38 MOCK_METHOD1(FormatMountedDevice, void(const std::string&)); 40 MOCK_METHOD1(FormatMountedDevice, void(const std::string&));
(...skipping 23 matching lines...) Expand all
62 private: 64 private:
63 // Is used to implement AddObserver. 65 // Is used to implement AddObserver.
64 void AddObserverInternal(DiskMountManager::Observer* observer); 66 void AddObserverInternal(DiskMountManager::Observer* observer);
65 67
66 // Is used to implement RemoveObserver. 68 // Is used to implement RemoveObserver.
67 void RemoveObserverInternal(DiskMountManager::Observer* observer); 69 void RemoveObserverInternal(DiskMountManager::Observer* observer);
68 70
69 // Is used to implement disks. 71 // Is used to implement disks.
70 const DiskMountManager::DiskMap& disksInternal() const { return disks_; } 72 const DiskMountManager::DiskMap& disksInternal() const { return disks_; }
71 73
72 // This function is primarily for MediaDeviceNotificationsTest.
73 const DiskMountManager::MountPointMap& mountPointsInternal() const; 74 const DiskMountManager::MountPointMap& mountPointsInternal() const;
74 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
75 // Notifies observers about device status update. 80 // Notifies observers about device status update.
76 void NotifyDeviceChanged(DiskMountManagerEventType event, 81 void NotifyDeviceChanged(DiskMountManagerEventType event,
77 const std::string& path); 82 const std::string& path);
78 83
79 // Notifies observers about disk status update. 84 // Notifies observers about disk status update.
80 void NotifyDiskChanged(DiskMountManagerEventType event, 85 void NotifyDiskChanged(DiskMountManagerEventType event,
81 const DiskMountManager::Disk* disk); 86 const DiskMountManager::Disk* disk);
82 87
83 // The list of observers. 88 // The list of observers.
84 ObserverList<DiskMountManager::Observer> observers_; 89 ObserverList<DiskMountManager::Observer> observers_;
85 90
86 // The list of disks found. 91 // The list of disks found.
87 DiskMountManager::DiskMap disks_; 92 DiskMountManager::DiskMap disks_;
88 93
89 // The list of existing mount points. 94 // The list of existing mount points.
90 DiskMountManager::MountPointMap mount_points_; 95 DiskMountManager::MountPointMap mount_points_;
91 96
92 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager); 97 DISALLOW_COPY_AND_ASSIGN(MockDiskMountManager);
93 }; 98 };
94 99
95 } // namespace disks 100 } // namespace disks
96 } // namespace chromeos 101 } // namespace chromeos
97 102
98 #endif // CHROME_BROWSER_CHROMEOS_DISKS_MOCK_DISK_MOUNT_MANAGER_H_ 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