| 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 #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 chromeos::DEVICE_TYPE_UNKNOWN, | 84 chromeos::DEVICE_TYPE_UNKNOWN, |
| 85 0, | 85 0, |
| 86 false, | 86 false, |
| 87 false, | 87 false, |
| 88 false, | 88 false, |
| 89 false, | 89 false, |
| 90 false, | 90 false, |
| 91 false); | 91 false); |
| 92 } | 92 } |
| 93 | 93 |
| 94 scoped_ptr<DeviceEventRouterImpl> device_event_router; | 94 std::unique_ptr<DeviceEventRouterImpl> device_event_router; |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 base::MessageLoop message_loop_; | 97 base::MessageLoop message_loop_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 TEST_F(DeviceEventRouterTest, AddAndRemoveDevice) { | 100 TEST_F(DeviceEventRouterTest, AddAndRemoveDevice) { |
| 101 const Disk disk1 = CreateTestDisk("/device/test", "/mount/path1"); | 101 const Disk disk1 = CreateTestDisk("/device/test", "/mount/path1"); |
| 102 const Disk disk1_unmounted = CreateTestDisk("/device/test", ""); | 102 const Disk disk1_unmounted = CreateTestDisk("/device/test", ""); |
| 103 scoped_ptr<Volume> volume(Volume::CreateForTesting( | 103 std::unique_ptr<Volume> volume(Volume::CreateForTesting( |
| 104 base::FilePath(FILE_PATH_LITERAL("/device/test")), | 104 base::FilePath(FILE_PATH_LITERAL("/device/test")), |
| 105 base::FilePath(FILE_PATH_LITERAL("/mount/path1")))); | 105 base::FilePath(FILE_PATH_LITERAL("/mount/path1")))); |
| 106 device_event_router->OnDeviceAdded("/device/test"); | 106 device_event_router->OnDeviceAdded("/device/test"); |
| 107 device_event_router->OnDiskAdded(disk1, true); | 107 device_event_router->OnDiskAdded(disk1, true); |
| 108 device_event_router->OnVolumeMounted(chromeos::MOUNT_ERROR_NONE, | 108 device_event_router->OnVolumeMounted(chromeos::MOUNT_ERROR_NONE, |
| 109 *volume.get()); | 109 *volume.get()); |
| 110 device_event_router->OnVolumeUnmounted(chromeos::MOUNT_ERROR_NONE, | 110 device_event_router->OnVolumeUnmounted(chromeos::MOUNT_ERROR_NONE, |
| 111 *volume.get()); | 111 *volume.get()); |
| 112 device_event_router->OnDiskRemoved(disk1_unmounted); | 112 device_event_router->OnDiskRemoved(disk1_unmounted); |
| 113 device_event_router->OnDeviceRemoved("/device/test"); | 113 device_event_router->OnDeviceRemoved("/device/test"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 130 ASSERT_EQ(2u, device_event_router->events.size()); | 130 ASSERT_EQ(2u, device_event_router->events.size()); |
| 131 EXPECT_EQ(file_manager_private::DEVICE_EVENT_TYPE_HARD_UNPLUGGED, | 131 EXPECT_EQ(file_manager_private::DEVICE_EVENT_TYPE_HARD_UNPLUGGED, |
| 132 device_event_router->events[0].type); | 132 device_event_router->events[0].type); |
| 133 EXPECT_EQ("/device/test", device_event_router->events[0].device_path); | 133 EXPECT_EQ("/device/test", device_event_router->events[0].device_path); |
| 134 EXPECT_EQ(file_manager_private::DEVICE_EVENT_TYPE_REMOVED, | 134 EXPECT_EQ(file_manager_private::DEVICE_EVENT_TYPE_REMOVED, |
| 135 device_event_router->events[1].type); | 135 device_event_router->events[1].type); |
| 136 EXPECT_EQ("/device/test", device_event_router->events[1].device_path); | 136 EXPECT_EQ("/device/test", device_event_router->events[1].device_path); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace file_manager | 139 } // namespace file_manager |
| OLD | NEW |