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 // RemovableDeviceNotificationsLinux unit tests. | 5 // RemovableDeviceNotificationsLinux unit tests. |
6 | 6 |
7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" | 7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
8 | 8 |
9 #include <mntent.h> | 9 #include <mntent.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 MtabTestData("dummydevice", "dummydir", kInvalidFS), | 198 MtabTestData("dummydevice", "dummydir", kInvalidFS), |
199 }; | 199 }; |
200 WriteToMtab(initial_test_data, | 200 WriteToMtab(initial_test_data, |
201 arraysize(initial_test_data), | 201 arraysize(initial_test_data), |
202 true /* overwrite */); | 202 true /* overwrite */); |
203 | 203 |
204 // Initialize the test subject. | 204 // Initialize the test subject. |
205 notifications_ = new RemovableDeviceNotificationsLinuxTestWrapper( | 205 notifications_ = new RemovableDeviceNotificationsLinuxTestWrapper( |
206 mtab_file_, &message_loop_); | 206 mtab_file_, &message_loop_); |
207 notifications_->Init(); | 207 notifications_->Init(); |
208 message_loop_.RunAllPending(); | 208 message_loop_.RunUntilIdle(); |
209 } | 209 } |
210 | 210 |
211 virtual void TearDown() OVERRIDE { | 211 virtual void TearDown() OVERRIDE { |
212 message_loop_.RunAllPending(); | 212 message_loop_.RunUntilIdle(); |
213 notifications_ = NULL; | 213 notifications_ = NULL; |
214 system_monitor_.RemoveDevicesChangedObserver( | 214 system_monitor_.RemoveDevicesChangedObserver( |
215 mock_devices_changed_observer_.get()); | 215 mock_devices_changed_observer_.get()); |
216 } | 216 } |
217 | 217 |
218 // Append mtab entries from the |data| array of size |data_size| to the mtab | 218 // Append mtab entries from the |data| array of size |data_size| to the mtab |
219 // file, and run the message loop. | 219 // file, and run the message loop. |
220 void AppendToMtabAndRunLoop(const MtabTestData* data, size_t data_size) { | 220 void AppendToMtabAndRunLoop(const MtabTestData* data, size_t data_size) { |
221 WriteToMtab(data, data_size, false /* do not overwrite */); | 221 WriteToMtab(data, data_size, false /* do not overwrite */); |
222 message_loop_.Run(); | 222 message_loop_.Run(); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 notifier()->GetStorageSize(test_path_a.value())); | 684 notifier()->GetStorageSize(test_path_a.value())); |
685 EXPECT_EQ(GetDevicePartitionSize(kDeviceNoDCIM), | 685 EXPECT_EQ(GetDevicePartitionSize(kDeviceNoDCIM), |
686 notifier()->GetStorageSize(test_path_b.value())); | 686 notifier()->GetStorageSize(test_path_b.value())); |
687 EXPECT_EQ(GetDevicePartitionSize(kInvalidPath), | 687 EXPECT_EQ(GetDevicePartitionSize(kInvalidPath), |
688 notifier()->GetStorageSize(kInvalidPath)); | 688 notifier()->GetStorageSize(kInvalidPath)); |
689 } | 689 } |
690 | 690 |
691 } // namespace | 691 } // namespace |
692 | 692 |
693 } // namespace chrome | 693 } // namespace chrome |
OLD | NEW |