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 "chromeos/disks/mock_disk_mount_manager.h" | 5 #include "chromeos/disks/mock_disk_mount_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 this, &MockDiskMountManager::EnsureMountInfoRefreshedInternal)); | 66 this, &MockDiskMountManager::EnsureMountInfoRefreshedInternal)); |
67 } | 67 } |
68 | 68 |
69 MockDiskMountManager::~MockDiskMountManager() { | 69 MockDiskMountManager::~MockDiskMountManager() { |
70 } | 70 } |
71 | 71 |
72 void MockDiskMountManager::NotifyDeviceInsertEvents() { | 72 void MockDiskMountManager::NotifyDeviceInsertEvents() { |
73 std::unique_ptr<DiskMountManager::Disk> disk1_ptr = | 73 std::unique_ptr<DiskMountManager::Disk> disk1_ptr = |
74 base::MakeUnique<DiskMountManager::Disk>( | 74 base::MakeUnique<DiskMountManager::Disk>( |
75 std::string(kTestDevicePath), std::string(), | 75 std::string(kTestDevicePath), std::string(), |
76 false, // write_disabled_by_policy | |
hashimoto
2016/10/21 07:28:04
nit: 2 spaces before a comment.
The same goes for
yamaguchi
2016/10/21 08:27:03
Done.
| |
76 std::string(kTestSystemPath), std::string(kTestFilePath), | 77 std::string(kTestSystemPath), std::string(kTestFilePath), |
77 std::string(), std::string(kTestDriveLabel), | 78 std::string(), std::string(kTestDriveLabel), |
78 std::string(kTestVendorId), std::string(kTestVendorName), | 79 std::string(kTestVendorId), std::string(kTestVendorName), |
79 std::string(kTestProductId), std::string(kTestProductName), | 80 std::string(kTestProductId), std::string(kTestProductName), |
80 std::string(kTestUuid), std::string(kTestSystemPathPrefix), | 81 std::string(kTestUuid), std::string(kTestSystemPathPrefix), |
81 DEVICE_TYPE_USB, 4294967295U, | 82 DEVICE_TYPE_USB, 4294967295U, |
82 false, // is_parent | 83 false, // is_parent |
83 false, // is_read_only | 84 false, // is_read_only |
84 true, // has_media | 85 true, // has_media |
85 false, // on_boot_device | 86 false, // on_boot_device |
86 true, // on_removable_device | 87 true, // on_removable_device |
87 false); // is_hidden | 88 false); // is_hidden |
88 DiskMountManager::Disk* disk1 = disk1_ptr.get(); | 89 DiskMountManager::Disk* disk1 = disk1_ptr.get(); |
89 | 90 |
90 disks_.clear(); | 91 disks_.clear(); |
91 disks_[std::string(kTestDevicePath)] = std::move(disk1_ptr); | 92 disks_[std::string(kTestDevicePath)] = std::move(disk1_ptr); |
92 | 93 |
93 // Device Added | 94 // Device Added |
94 NotifyDeviceChanged(DEVICE_ADDED, kTestSystemPath); | 95 NotifyDeviceChanged(DEVICE_ADDED, kTestSystemPath); |
95 | 96 |
96 // Disk Added | 97 // Disk Added |
97 NotifyDiskChanged(DISK_ADDED, disk1); | 98 NotifyDiskChanged(DISK_ADDED, disk1); |
98 | 99 |
99 // Disk Changed | 100 // Disk Changed |
100 std::unique_ptr<DiskMountManager::Disk> disk2_ptr = | 101 std::unique_ptr<DiskMountManager::Disk> disk2_ptr = |
101 base::MakeUnique<DiskMountManager::Disk>( | 102 base::MakeUnique<DiskMountManager::Disk>( |
102 std::string(kTestDevicePath), std::string(kTestMountPath), | 103 std::string(kTestDevicePath), std::string(kTestMountPath), |
104 false, // write_disabled_by_policy | |
103 std::string(kTestSystemPath), std::string(kTestFilePath), | 105 std::string(kTestSystemPath), std::string(kTestFilePath), |
104 std::string(kTestDeviceLabel), std::string(kTestDriveLabel), | 106 std::string(kTestDeviceLabel), std::string(kTestDriveLabel), |
105 std::string(kTestVendorId), std::string(kTestVendorName), | 107 std::string(kTestVendorId), std::string(kTestVendorName), |
106 std::string(kTestProductId), std::string(kTestProductName), | 108 std::string(kTestProductId), std::string(kTestProductName), |
107 std::string(kTestUuid), std::string(kTestSystemPathPrefix), | 109 std::string(kTestUuid), std::string(kTestSystemPathPrefix), |
108 DEVICE_TYPE_MOBILE, 1073741824, | 110 DEVICE_TYPE_MOBILE, 1073741824, |
109 false, // is_parent | 111 false, // is_parent |
110 false, // is_read_only | 112 false, // is_read_only |
111 true, // has_media | 113 true, // has_media |
112 false, // on_boot_device | 114 false, // on_boot_device |
113 true, // on_removable_device | 115 true, // on_removable_device |
114 false); // is_hidden | 116 false); // is_hidden |
115 DiskMountManager::Disk* disk2 = disk2_ptr.get(); | 117 DiskMountManager::Disk* disk2 = disk2_ptr.get(); |
116 disks_.clear(); | 118 disks_.clear(); |
117 disks_[std::string(kTestDevicePath)] = std::move(disk2_ptr); | 119 disks_[std::string(kTestDevicePath)] = std::move(disk2_ptr); |
118 NotifyDiskChanged(DISK_CHANGED, disk2); | 120 NotifyDiskChanged(DISK_CHANGED, disk2); |
119 } | 121 } |
120 | 122 |
121 void MockDiskMountManager::NotifyDeviceRemoveEvents() { | 123 void MockDiskMountManager::NotifyDeviceRemoveEvents() { |
122 std::unique_ptr<DiskMountManager::Disk> disk_ptr = | 124 std::unique_ptr<DiskMountManager::Disk> disk_ptr = |
123 base::MakeUnique<DiskMountManager::Disk>( | 125 base::MakeUnique<DiskMountManager::Disk>( |
124 std::string(kTestDevicePath), std::string(kTestMountPath), | 126 std::string(kTestDevicePath), std::string(kTestMountPath), |
127 false, // write_disabled_by_policy | |
125 std::string(kTestSystemPath), std::string(kTestFilePath), | 128 std::string(kTestSystemPath), std::string(kTestFilePath), |
126 std::string(kTestDeviceLabel), std::string(kTestDriveLabel), | 129 std::string(kTestDeviceLabel), std::string(kTestDriveLabel), |
127 std::string(kTestVendorId), std::string(kTestVendorName), | 130 std::string(kTestVendorId), std::string(kTestVendorName), |
128 std::string(kTestProductId), std::string(kTestProductName), | 131 std::string(kTestProductId), std::string(kTestProductName), |
129 std::string(kTestUuid), std::string(kTestSystemPathPrefix), | 132 std::string(kTestUuid), std::string(kTestSystemPathPrefix), |
130 DEVICE_TYPE_SD, 1073741824, | 133 DEVICE_TYPE_SD, 1073741824, |
131 false, // is_parent | 134 false, // is_parent |
132 false, // is_read_only | 135 false, // is_read_only |
133 true, // has_media | 136 true, // has_media |
134 false, // on_boot_device | 137 false, // on_boot_device |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 const std::string& product_name, | 172 const std::string& product_name, |
170 DeviceType device_type, | 173 DeviceType device_type, |
171 uint64_t total_size_in_bytes, | 174 uint64_t total_size_in_bytes, |
172 bool is_parent, | 175 bool is_parent, |
173 bool has_media, | 176 bool has_media, |
174 bool on_boot_device, | 177 bool on_boot_device, |
175 bool on_removable_device) { | 178 bool on_removable_device) { |
176 std::unique_ptr<DiskMountManager::Disk> disk_ptr = | 179 std::unique_ptr<DiskMountManager::Disk> disk_ptr = |
177 base::MakeUnique<DiskMountManager::Disk>( | 180 base::MakeUnique<DiskMountManager::Disk>( |
178 mount_info.source_path, mount_info.mount_path, | 181 mount_info.source_path, mount_info.mount_path, |
182 false, // write_disabled_by_policy | |
179 std::string(), // system_path | 183 std::string(), // system_path |
180 mount_info.source_path, device_label, | 184 mount_info.source_path, device_label, |
181 std::string(), // drive_label | 185 std::string(), // drive_label |
182 std::string(), // vendor_id | 186 std::string(), // vendor_id |
183 vendor_name, | 187 vendor_name, |
184 std::string(), // product_id | 188 std::string(), // product_id |
185 product_name, | 189 product_name, |
186 device_id, // fs_uuid | 190 device_id, // fs_uuid |
187 std::string(), // system_path_prefix | 191 std::string(), // system_path_prefix |
188 device_type, total_size_in_bytes, is_parent, | 192 device_type, total_size_in_bytes, is_parent, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 } | 227 } |
224 | 228 |
225 void MockDiskMountManager::NotifyDeviceChanged(DeviceEvent event, | 229 void MockDiskMountManager::NotifyDeviceChanged(DeviceEvent event, |
226 const std::string& path) { | 230 const std::string& path) { |
227 for (auto& observer : observers_) | 231 for (auto& observer : observers_) |
228 observer.OnDeviceEvent(event, path); | 232 observer.OnDeviceEvent(event, path); |
229 } | 233 } |
230 | 234 |
231 } // namespace disks | 235 } // namespace disks |
232 } // namespace chromeos | 236 } // namespace chromeos |
OLD | NEW |