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

Side by Side Diff: chrome/browser/chromeos/cros/mock_mount_library.h

Issue 1238006: Adding new test for mount observer. Also changing the usb mounter to only rel... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/mock_mount_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_CROS_MOCK_MOUNT_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
11 #include "base/observer_list.h"
12 #include "base/time.h"
13 #include "third_party/cros/chromeos_mount.h"
10 #include "chrome/browser/chromeos/cros/mount_library.h" 14 #include "chrome/browser/chromeos/cros/mount_library.h"
15 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
12 17
13 namespace chromeos { 18 namespace chromeos {
14 19
20 // This class handles the interaction with the ChromeOS mount library APIs.
21 // Classes can add themselves as observers. Users can get an instance of this
22 // library class like this: MountLibrary::Get().
15 class MockMountLibrary : public MountLibrary { 23 class MockMountLibrary : public MountLibrary {
16 public: 24 public:
17 MockMountLibrary() {} 25 MockMountLibrary();
18 virtual ~MockMountLibrary() {} 26 virtual ~MockMountLibrary();
19 MOCK_METHOD1(AddObserver, void(Observer*)); 27
20 MOCK_METHOD1(RemoveObserver, void(Observer*)); 28 MOCK_METHOD1(AddObserver, void(MountLibrary::Observer*));
21 MOCK_CONST_METHOD0(disks, const DiskVector&(void)); 29 MOCK_METHOD1(RemoveObserver, void(MountLibrary::Observer*));
30 MOCK_CONST_METHOD0(disks, const MountLibrary::DiskVector&(void));
31
32 void FireDeviceInsertEvents();
33 void FireDeviceRemoveEvents();
34
35 private:
36 void AddObserverInternal(MountLibrary::Observer* observer);
37 void RemoveObserverInternal(MountLibrary::Observer* observer);
38 const MountLibrary::DiskVector& disksInternal() const { return disks_; }
39
40
41 void UpdateMountStatus(MountEventType evt,
42 const std::string& path);
43
44 ObserverList<MountLibrary::Observer> observers_;
45
46 // The list of disks found.
47 MountLibrary::DiskVector disks_;
48
49 DISALLOW_COPY_AND_ASSIGN(MockMountLibrary);
22 }; 50 };
23 51
24 } // namespace chromeos 52 } // namespace chromeos
25 53
26 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_ 54 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/mock_mount_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698