OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // This file contains a subclass of VolumeMountWatcherWin to expose some | 5 // This file contains a subclass of VolumeMountWatcherWin to expose some |
6 // functionality for testing. | 6 // functionality for testing. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_ | 8 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_ |
9 #define CHROME_BROWSER_SYSTEM_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_ | 9 #define CHROME_BROWSER_SYSTEM_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h" | 16 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h" |
17 | 17 |
| 18 namespace base { |
18 class FilePath; | 19 class FilePath; |
| 20 } |
19 | 21 |
20 namespace chrome { | 22 namespace chrome { |
21 namespace test { | 23 namespace test { |
22 | 24 |
23 class TestVolumeMountWatcherWin : public VolumeMountWatcherWin { | 25 class TestVolumeMountWatcherWin : public VolumeMountWatcherWin { |
24 public: | 26 public: |
25 TestVolumeMountWatcherWin(); | 27 TestVolumeMountWatcherWin(); |
26 virtual ~TestVolumeMountWatcherWin(); | 28 virtual ~TestVolumeMountWatcherWin(); |
27 | 29 |
28 void AddDeviceForTesting(const FilePath& device_path, | 30 void AddDeviceForTesting(const base::FilePath& device_path, |
29 const std::string& device_id, | 31 const std::string& device_id, |
30 const std::string& unique_id, | 32 const std::string& unique_id, |
31 const string16& device_name, | 33 const string16& device_name, |
32 bool removable); | 34 bool removable); |
33 | 35 |
34 void SetAttachedDevicesFake(); | 36 void SetAttachedDevicesFake(); |
35 | 37 |
36 void FlushWorkerPoolForTesting(); | 38 void FlushWorkerPoolForTesting(); |
37 | 39 |
38 virtual void DeviceCheckComplete(const FilePath& device_path); | 40 virtual void DeviceCheckComplete(const base::FilePath& device_path); |
39 | 41 |
40 std::vector<FilePath> devices_checked() const { return devices_checked_; } | 42 std::vector<base::FilePath> devices_checked() const { return devices_checked_;
} |
41 | 43 |
42 void BlockDeviceCheckForTesting(); | 44 void BlockDeviceCheckForTesting(); |
43 | 45 |
44 void ReleaseDeviceCheck(); | 46 void ReleaseDeviceCheck(); |
45 | 47 |
46 // VolumeMountWatcherWin: | 48 // VolumeMountWatcherWin: |
47 virtual bool GetDeviceInfo(const FilePath& device_path, | 49 virtual bool GetDeviceInfo(const base::FilePath& device_path, |
48 string16* device_location, | 50 string16* device_location, |
49 std::string* unique_id, | 51 std::string* unique_id, |
50 string16* name, | 52 string16* name, |
51 bool* removable) const OVERRIDE; | 53 bool* removable) const OVERRIDE; |
52 virtual std::vector<FilePath> GetAttachedDevices(); | 54 virtual std::vector<base::FilePath> GetAttachedDevices(); |
53 | 55 |
54 bool GetRawDeviceInfo(const FilePath& device_path, | 56 bool GetRawDeviceInfo(const base::FilePath& device_path, |
55 string16* device_location, | 57 string16* device_location, |
56 std::string* unique_id, | 58 std::string* unique_id, |
57 string16* name, | 59 string16* name, |
58 bool* removable); | 60 bool* removable); |
59 | 61 |
60 private: | 62 private: |
61 std::vector<FilePath> devices_checked_; | 63 std::vector<base::FilePath> devices_checked_; |
62 scoped_ptr<base::WaitableEvent> device_check_complete_event_; | 64 scoped_ptr<base::WaitableEvent> device_check_complete_event_; |
63 | 65 |
64 DISALLOW_COPY_AND_ASSIGN(TestVolumeMountWatcherWin); | 66 DISALLOW_COPY_AND_ASSIGN(TestVolumeMountWatcherWin); |
65 }; | 67 }; |
66 | 68 |
67 } // namespace test | 69 } // namespace test |
68 } // namespace chrome | 70 } // namespace chrome |
69 | 71 |
70 #endif // CHROME_BROWSER_SYSTEM_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_ | 72 #endif // CHROME_BROWSER_SYSTEM_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_ |
OLD | NEW |