Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / storage_monitor / test_volume_mount_watcher_win.h
blob0ba3887cdbe0414a1cb59e69f1d19693b2282c15
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
3 // found in the LICENSE file.
4 //
5 // This file contains a subclass of VolumeMountWatcherWin to expose some
6 // functionality for testing.
8 #ifndef CHROME_BROWSER_STORAGE_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_
9 #define CHROME_BROWSER_STORAGE_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_
11 #include <string>
12 #include <vector>
14 #include "base/strings/string16.h"
15 #include "base/synchronization/waitable_event.h"
16 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h"
18 namespace base {
19 class FilePath;
22 class TestVolumeMountWatcherWin : public VolumeMountWatcherWin {
23 public:
24 TestVolumeMountWatcherWin();
25 virtual ~TestVolumeMountWatcherWin();
27 static bool GetDeviceRemovable(const base::FilePath& device_path,
28 bool* removable);
30 void AddDeviceForTesting(const base::FilePath& device_path,
31 const std::string& device_id,
32 const base::string16& device_name,
33 uint64 total_size_in_bytes);
35 void SetAttachedDevicesFake();
37 void FlushWorkerPoolForTesting();
39 virtual void DeviceCheckComplete(const base::FilePath& device_path);
41 const std::vector<base::FilePath>& devices_checked() const {
42 return devices_checked_;
45 void BlockDeviceCheckForTesting();
47 void ReleaseDeviceCheck();
49 // VolumeMountWatcherWin:
50 virtual GetAttachedDevicesCallbackType
51 GetAttachedDevicesCallback() const OVERRIDE;
52 virtual GetDeviceDetailsCallbackType
53 GetDeviceDetailsCallback() const OVERRIDE;
55 // Should be used by unit tests to make sure the worker pool doesn't survive
56 // into other test runs.
57 void ShutdownWorkerPool();
59 private:
60 std::vector<base::FilePath> devices_checked_;
61 scoped_ptr<base::WaitableEvent> device_check_complete_event_;
62 bool attached_devices_fake_;
64 DISALLOW_COPY_AND_ASSIGN(TestVolumeMountWatcherWin);
67 #endif // CHROME_BROWSER_STORAGE_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_