Complete SyncMessageFilter initialization after SyncChannel initialization
[chromium-blink-merge.git] / components / storage_monitor / test_portable_device_watcher_win.h
blob53275da585605717f796babefe17d0350d3446df
1 // Copyright 2014 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 PortableDeviceWatcherWin to expose some
6 // functionality for testing.
8 #ifndef COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_
9 #define COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_
11 #include <string>
13 #include "base/strings/string16.h"
14 #include "components/storage_monitor/portable_device_watcher_win.h"
16 namespace storage_monitor {
18 class TestPortableDeviceWatcherWin : public PortableDeviceWatcherWin {
19 public:
20 // MTP device PnP identifiers.
21 static const base::char16 kMTPDeviceWithMultipleStorages[];
22 static const base::char16 kMTPDeviceWithInvalidInfo[];
23 static const base::char16 kMTPDeviceWithValidInfo[];
25 // MTP device storage unique identifier.
26 static const char kStorageUniqueIdA[];
28 TestPortableDeviceWatcherWin();
29 ~TestPortableDeviceWatcherWin() override;
31 // Returns the persistent storage unique id of the device specified by the
32 // |pnp_device_id|. |storage_object_id| specifies the string ID that uniquely
33 // identifies the object on the device.
34 static std::string GetMTPStorageUniqueId(
35 const base::string16& pnp_device_id,
36 const base::string16& storage_object_id);
38 // Returns a list of storage object identifiers of the media transfer protocol
39 // (MTP) device given a |pnp_device_id|.
40 static PortableDeviceWatcherWin::StorageObjectIDs GetMTPStorageObjectIds(
41 const base::string16& pnp_device_id);
43 // Gets the media transfer protocol (MTP) device storage details given a
44 // |pnp_device_id| and |storage_object_id|.
45 static void GetMTPStorageDetails(const base::string16& pnp_device_id,
46 const base::string16& storage_object_id,
47 base::string16* device_location,
48 std::string* unique_id,
49 base::string16* name);
51 // Returns a list of device storage details for the given device specified by
52 // |pnp_device_id|.
53 static PortableDeviceWatcherWin::StorageObjects GetDeviceStorageObjects(
54 const base::string16& pnp_device_id);
56 // Used by MediaFileSystemRegistry unit test.
57 void set_use_dummy_mtp_storage_info(bool use_dummy_info) {
58 use_dummy_mtp_storage_info_ = use_dummy_info;
61 private:
62 // PortableDeviceWatcherWin:
63 void EnumerateAttachedDevices() override;
64 void HandleDeviceAttachEvent(const base::string16& pnp_device_id) override;
65 bool GetMTPStorageInfoFromDeviceId(
66 const std::string& storage_device_id,
67 base::string16* device_location,
68 base::string16* storage_object_id) const override;
70 // Set to true to get dummy storage details from
71 // GetMTPStorageInfoFromDeviceId().
72 bool use_dummy_mtp_storage_info_;
74 DISALLOW_COPY_AND_ASSIGN(TestPortableDeviceWatcherWin);
77 } // namespace storage_monitor
79 #endif // COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_