| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/system_monitor/system_monitor.h" | 6 #include "base/system_monitor/system_monitor.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/system_monitor/mock_removable_storage_observer.h" | 8 #include "chrome/browser/system_monitor/mock_removable_storage_observer.h" |
| 9 #include "chrome/browser/system_monitor/removable_storage_notifications.h" | 9 #include "chrome/browser/system_monitor/removable_storage_notifications.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace chrome { | 12 namespace chrome { |
| 13 | 13 |
| 14 class TestStorageNotifications : public RemovableStorageNotifications { | 14 class TestStorageNotifications : public RemovableStorageNotifications { |
| 15 public: | 15 public: |
| 16 TestStorageNotifications() { | 16 TestStorageNotifications() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 ~TestStorageNotifications() {} | 19 ~TestStorageNotifications() {} |
| 20 | 20 |
| 21 virtual bool GetDeviceInfoForPath( | 21 virtual bool GetDeviceInfoForPath( |
| 22 const FilePath& path, | 22 const FilePath& path, |
| 23 base::SystemMonitor::RemovableStorageInfo* device_info) const OVERRIDE { | 23 base::SystemMonitor::RemovableStorageInfo* device_info) const OVERRIDE { |
| 24 return false; | 24 return false; |
| 25 } | 25 } |
| 26 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE { | 26 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE { |
| 27 return 0; | 27 return 0; |
| 28 } | 28 } |
| 29 | 29 |
| 30 #if defined(OS_WIN) |
| 31 virtual bool GetMTPStorageInfoFromDeviceId( |
| 32 const std::string& storage_device_id, |
| 33 string16* device_location, |
| 34 string16* storage_object_id) const OVERRIDE { |
| 35 return false; |
| 36 } |
| 37 #endif |
| 38 |
| 30 void ProcessAttach(const std::string& id, | 39 void ProcessAttach(const std::string& id, |
| 31 const string16& name, | 40 const string16& name, |
| 32 const FilePath::StringType& location) { | 41 const FilePath::StringType& location) { |
| 33 RemovableStorageNotifications::ProcessAttach(id, name, location); | 42 RemovableStorageNotifications::ProcessAttach(id, name, location); |
| 34 } | 43 } |
| 35 | 44 |
| 36 void ProcessDetach(const std::string& id) { | 45 void ProcessDetach(const std::string& id) { |
| 37 RemovableStorageNotifications::ProcessDetach(id); | 46 RemovableStorageNotifications::ProcessDetach(id); |
| 38 } | 47 } |
| 39 }; | 48 }; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 EXPECT_EQ(kDeviceName2, devices[0].name); | 140 EXPECT_EQ(kDeviceName2, devices[0].name); |
| 132 EXPECT_EQ(kDevicePath2.value(), devices[0].location); | 141 EXPECT_EQ(kDevicePath2.value(), devices[0].location); |
| 133 | 142 |
| 134 notifications.ProcessDetach(kDeviceId2); | 143 notifications.ProcessDetach(kDeviceId2); |
| 135 message_loop.RunUntilIdle(); | 144 message_loop.RunUntilIdle(); |
| 136 devices = notifications.GetAttachedStorage(); | 145 devices = notifications.GetAttachedStorage(); |
| 137 EXPECT_EQ(0U, devices.size()); | 146 EXPECT_EQ(0U, devices.size()); |
| 138 } | 147 } |
| 139 | 148 |
| 140 } // namespace chrome | 149 } // namespace chrome |
| OLD | NEW |