| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/file_manager/mounted_disk_monitor.h" | 5 #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // Mount |disk1|. | 113 // Mount |disk1|. |
| 114 mounted_disk_monitor_->OnMountEvent( | 114 mounted_disk_monitor_->OnMountEvent( |
| 115 chromeos::disks::DiskMountManager::MOUNTING, | 115 chromeos::disks::DiskMountManager::MOUNTING, |
| 116 chromeos::MOUNT_ERROR_NONE, | 116 chromeos::MOUNT_ERROR_NONE, |
| 117 kMountPoint1); | 117 kMountPoint1); |
| 118 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk1_ptr)); | 118 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk1_ptr)); |
| 119 | 119 |
| 120 // Pseudo system suspend and resume. | 120 // Pseudo system suspend and resume. |
| 121 mounted_disk_monitor_->SuspendImminent(); | 121 mounted_disk_monitor_->SuspendImminent(); |
| 122 mounted_disk_monitor_->SystemResumed(base::TimeDelta::FromSeconds(0)); | 122 mounted_disk_monitor_->SuspendDone(base::TimeDelta::FromSeconds(0)); |
| 123 | 123 |
| 124 // On system resume, we expect unmount and then mount immediately. | 124 // On system resume, we expect unmount and then mount immediately. |
| 125 // During the phase, we expect the disk is remounting. | 125 // During the phase, we expect the disk is remounting. |
| 126 mounted_disk_monitor_->OnMountEvent( | 126 mounted_disk_monitor_->OnMountEvent( |
| 127 chromeos::disks::DiskMountManager::UNMOUNTING, | 127 chromeos::disks::DiskMountManager::UNMOUNTING, |
| 128 chromeos::MOUNT_ERROR_NONE, | 128 chromeos::MOUNT_ERROR_NONE, |
| 129 kMountPoint1); | 129 kMountPoint1); |
| 130 EXPECT_TRUE(mounted_disk_monitor_->DiskIsRemounting(*disk1_ptr)); | 130 EXPECT_TRUE(mounted_disk_monitor_->DiskIsRemounting(*disk1_ptr)); |
| 131 | 131 |
| 132 mounted_disk_monitor_->OnMountEvent( | 132 mounted_disk_monitor_->OnMountEvent( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 143 kMountPoint2); | 143 kMountPoint2); |
| 144 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk2_ptr)); | 144 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk2_ptr)); |
| 145 | 145 |
| 146 // After certain period, remounting state should be cleared. | 146 // After certain period, remounting state should be cleared. |
| 147 base::RunLoop().RunUntilIdle(); // Emulate time passage. | 147 base::RunLoop().RunUntilIdle(); // Emulate time passage. |
| 148 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk1_ptr)); | 148 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk1_ptr)); |
| 149 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk2_ptr)); | 149 EXPECT_FALSE(mounted_disk_monitor_->DiskIsRemounting(*disk2_ptr)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace file_manager | 152 } // namespace file_manager |
| OLD | NEW |