| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 const std::string& storage_device_id, | 32 const std::string& storage_device_id, |
| 33 string16* device_location, | 33 string16* device_location, |
| 34 string16* storage_object_id) const OVERRIDE { | 34 string16* storage_object_id) const OVERRIDE { |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 void ProcessAttach(const std::string& id, | 39 void ProcessAttach(const std::string& id, |
| 40 const string16& name, | 40 const string16& name, |
| 41 const base::FilePath::StringType& location) { | 41 const base::FilePath::StringType& location) { |
| 42 receiver()->ProcessAttach(id, name, location); | 42 receiver()->ProcessAttach(RemovableStorageNotifications::StorageInfo( |
| 43 id, name, location)); |
| 43 } | 44 } |
| 44 | 45 |
| 45 void ProcessDetach(const std::string& id) { | 46 void ProcessDetach(const std::string& id) { |
| 46 receiver()->ProcessDetach(id); | 47 receiver()->ProcessDetach(id); |
| 47 } | 48 } |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 TEST(RemovableStorageNotificationsTest, DeviceAttachDetachNotifications) { | 51 TEST(RemovableStorageNotificationsTest, DeviceAttachDetachNotifications) { |
| 51 MessageLoop message_loop; | 52 MessageLoop message_loop; |
| 52 const string16 kDeviceName = ASCIIToUTF16("media device"); | 53 const string16 kDeviceName = ASCIIToUTF16("media device"); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 EXPECT_EQ(kDeviceName2, devices[0].name); | 141 EXPECT_EQ(kDeviceName2, devices[0].name); |
| 141 EXPECT_EQ(kDevicePath2.value(), devices[0].location); | 142 EXPECT_EQ(kDevicePath2.value(), devices[0].location); |
| 142 | 143 |
| 143 notifications.ProcessDetach(kDeviceId2); | 144 notifications.ProcessDetach(kDeviceId2); |
| 144 message_loop.RunUntilIdle(); | 145 message_loop.RunUntilIdle(); |
| 145 devices = notifications.GetAttachedStorage(); | 146 devices = notifications.GetAttachedStorage(); |
| 146 EXPECT_EQ(0U, devices.size()); | 147 EXPECT_EQ(0U, devices.size()); |
| 147 } | 148 } |
| 148 | 149 |
| 149 } // namespace chrome | 150 } // namespace chrome |
| OLD | NEW |