| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 PortableDeviceWatcherWin to expose some | 5 // This file contains a subclass of PortableDeviceWatcherWin to expose some |
| 6 // functionality for testing. | 6 // functionality for testing. |
| 7 | 7 |
| 8 #ifndef COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_ | 8 #ifndef COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_ |
| 9 #define COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_ | 9 #define COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "components/storage_monitor/portable_device_watcher_win.h" | 14 #include "components/storage_monitor/portable_device_watcher_win.h" |
| 15 | 15 |
| 16 namespace storage_monitor { | 16 namespace storage_monitor { |
| 17 | 17 |
| 18 class TestPortableDeviceWatcherWin : public PortableDeviceWatcherWin { | 18 class TestPortableDeviceWatcherWin : public PortableDeviceWatcherWin { |
| 19 public: | 19 public: |
| 20 // MTP device PnP identifiers. | 20 // MTP device PnP identifiers. |
| 21 static const base::char16 kMTPDeviceWithMultipleStorages[]; | 21 static const base::char16 kMTPDeviceWithMultipleStorages[]; |
| 22 static const base::char16 kMTPDeviceWithInvalidInfo[]; | 22 static const base::char16 kMTPDeviceWithInvalidInfo[]; |
| 23 static const base::char16 kMTPDeviceWithValidInfo[]; | 23 static const base::char16 kMTPDeviceWithValidInfo[]; |
| 24 | 24 |
| 25 // MTP device storage unique identifier. | 25 // MTP device storage unique identifier. |
| 26 static const char kStorageUniqueIdA[]; | 26 static const char kStorageUniqueIdA[]; |
| 27 | 27 |
| 28 TestPortableDeviceWatcherWin(); | 28 TestPortableDeviceWatcherWin(); |
| 29 virtual ~TestPortableDeviceWatcherWin(); | 29 ~TestPortableDeviceWatcherWin() override; |
| 30 | 30 |
| 31 // Returns the persistent storage unique id of the device specified by the | 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 | 32 // |pnp_device_id|. |storage_object_id| specifies the string ID that uniquely |
| 33 // identifies the object on the device. | 33 // identifies the object on the device. |
| 34 static std::string GetMTPStorageUniqueId( | 34 static std::string GetMTPStorageUniqueId( |
| 35 const base::string16& pnp_device_id, | 35 const base::string16& pnp_device_id, |
| 36 const base::string16& storage_object_id); | 36 const base::string16& storage_object_id); |
| 37 | 37 |
| 38 // Returns a list of storage object identifiers of the media transfer protocol | 38 // Returns a list of storage object identifiers of the media transfer protocol |
| 39 // (MTP) device given a |pnp_device_id|. | 39 // (MTP) device given a |pnp_device_id|. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 static PortableDeviceWatcherWin::StorageObjects GetDeviceStorageObjects( | 53 static PortableDeviceWatcherWin::StorageObjects GetDeviceStorageObjects( |
| 54 const base::string16& pnp_device_id); | 54 const base::string16& pnp_device_id); |
| 55 | 55 |
| 56 // Used by MediaFileSystemRegistry unit test. | 56 // Used by MediaFileSystemRegistry unit test. |
| 57 void set_use_dummy_mtp_storage_info(bool use_dummy_info) { | 57 void set_use_dummy_mtp_storage_info(bool use_dummy_info) { |
| 58 use_dummy_mtp_storage_info_ = use_dummy_info; | 58 use_dummy_mtp_storage_info_ = use_dummy_info; |
| 59 } | 59 } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 // PortableDeviceWatcherWin: | 62 // PortableDeviceWatcherWin: |
| 63 virtual void EnumerateAttachedDevices() override; | 63 void EnumerateAttachedDevices() override; |
| 64 virtual void HandleDeviceAttachEvent( | 64 void HandleDeviceAttachEvent(const base::string16& pnp_device_id) override; |
| 65 const base::string16& pnp_device_id) override; | 65 bool GetMTPStorageInfoFromDeviceId( |
| 66 virtual bool GetMTPStorageInfoFromDeviceId( | |
| 67 const std::string& storage_device_id, | 66 const std::string& storage_device_id, |
| 68 base::string16* device_location, | 67 base::string16* device_location, |
| 69 base::string16* storage_object_id) const override; | 68 base::string16* storage_object_id) const override; |
| 70 | 69 |
| 71 // Set to true to get dummy storage details from | 70 // Set to true to get dummy storage details from |
| 72 // GetMTPStorageInfoFromDeviceId(). | 71 // GetMTPStorageInfoFromDeviceId(). |
| 73 bool use_dummy_mtp_storage_info_; | 72 bool use_dummy_mtp_storage_info_; |
| 74 | 73 |
| 75 DISALLOW_COPY_AND_ASSIGN(TestPortableDeviceWatcherWin); | 74 DISALLOW_COPY_AND_ASSIGN(TestPortableDeviceWatcherWin); |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 } // namespace storage_monitor | 77 } // namespace storage_monitor |
| 79 | 78 |
| 80 #endif // COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_ | 79 #endif // COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_ |
| OLD | NEW |