| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "chromeos/dbus/fake_cros_disks_client.h" | 7 #include "chromeos/dbus/fake_cros_disks_client.h" |
| 8 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" | 8 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" |
| 9 #include "chromeos/disks/disk_mount_manager.h" | 9 #include "chromeos/disks/disk_mount_manager.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 for (size_t i = 0; i < arraysize(kTestDisks); i++) | 193 for (size_t i = 0; i < arraysize(kTestDisks); i++) |
| 194 AddTestDisk(kTestDisks[i]); | 194 AddTestDisk(kTestDisks[i]); |
| 195 | 195 |
| 196 for (size_t i = 0; i < arraysize(kTestMountPoints); i++) | 196 for (size_t i = 0; i < arraysize(kTestMountPoints); i++) |
| 197 AddTestMountPoint(kTestMountPoints[i]); | 197 AddTestMountPoint(kTestMountPoints[i]); |
| 198 } | 198 } |
| 199 | 199 |
| 200 protected: | 200 protected: |
| 201 chromeos::FakeCrosDisksClient* fake_cros_disks_client_; | 201 chromeos::FakeCrosDisksClient* fake_cros_disks_client_; |
| 202 MockDiskMountManagerObserver observer_; | 202 MockDiskMountManagerObserver observer_; |
| 203 MessageLoopForUI message_loop_; | 203 base::MessageLoopForUI message_loop_; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 // Tests that the observer gets notified on attempt to format non existent mount | 206 // Tests that the observer gets notified on attempt to format non existent mount |
| 207 // point. | 207 // point. |
| 208 TEST_F(DiskMountManagerTest, Format_NotMounted) { | 208 TEST_F(DiskMountManagerTest, Format_NotMounted) { |
| 209 EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED, | 209 EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED, |
| 210 chromeos::FORMAT_ERROR_UNKNOWN, | 210 chromeos::FORMAT_ERROR_UNKNOWN, |
| 211 "/mount/non_existent")) | 211 "/mount/non_existent")) |
| 212 .Times(1); | 212 .Times(1); |
| 213 DiskMountManager::GetInstance()->FormatMountedDevice("/mount/non_existent"); | 213 DiskMountManager::GetInstance()->FormatMountedDevice("/mount/non_existent"); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 EXPECT_EQ("vfat", | 625 EXPECT_EQ("vfat", |
| 626 fake_cros_disks_client_->last_format_device_filesystem()); | 626 fake_cros_disks_client_->last_format_device_filesystem()); |
| 627 | 627 |
| 628 // Simulate cros_disks reporting success. | 628 // Simulate cros_disks reporting success. |
| 629 fake_cros_disks_client_->SendMountEvent( | 629 fake_cros_disks_client_->SendMountEvent( |
| 630 chromeos::CROS_DISKS_FORMATTING_FINISHED, "/device/source_path"); | 630 chromeos::CROS_DISKS_FORMATTING_FINISHED, "/device/source_path"); |
| 631 } | 631 } |
| 632 | 632 |
| 633 } // namespace | 633 } // namespace |
| 634 | 634 |
| OLD | NEW |