Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: chromeos/disks/disk_mount_manager_unittest.cc

Issue 12537016: Add callback to DiskMountManager::UnmountPath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/disks/disk_mount_manager.cc ('k') | chromeos/disks/mock_disk_mount_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/disks/disk_mount_manager_unittest.cc
diff --git a/chromeos/disks/disk_mount_manager_unittest.cc b/chromeos/disks/disk_mount_manager_unittest.cc
index a66aab9882bc59d2fd63647719a383fd6dcd1373..72cfbb5b5ddd91e7bda6419566e6bb408427a77b 100644
--- a/chromeos/disks/disk_mount_manager_unittest.cc
+++ b/chromeos/disks/disk_mount_manager_unittest.cc
@@ -331,14 +331,15 @@ TEST_F(DiskMountManagerTest, Format_FormatFailsToStart) {
// Tests the case where there are two format requests for the same device.
TEST_F(DiskMountManagerTest, Format_ConcurrentFormatCalls) {
// Set up cros disks client mocks.
- // Only the first format request should be processed (for the other one there
- // should be an error before device unmount is attempted).
+ // Only the first format request should be processed (the second unmount
+ // request fails because the device is already unmounted at that point).
// CrosDisksClient will report that the format process for the first request
// is successfully started.
EXPECT_CALL(*mock_cros_disks_client_,
Unmount("/device/mount_path", chromeos::UNMOUNT_OPTIONS_NONE,
_, _))
- .WillOnce(MockUnmountPath(true));
+ .WillOnce(MockUnmountPath(true))
+ .WillOnce(MockUnmountPath(false));
EXPECT_CALL(*mock_cros_disks_client_,
FormatDevice("/device/source_path", "vfat", _, _))
@@ -348,19 +349,15 @@ TEST_F(DiskMountManagerTest, Format_ConcurrentFormatCalls) {
// The observer should get two FORMAT_STARTED events, one for each format
// request, but with different error codes (the formatting will be started
// only for the first request).
- // There should alos be one UNMOUNTING event, since the device should get
- // unmounted for the first request.
+ // There should be only one UNMOUNTING event. The result of the second one
+ // should not be reported as the mount point will go away after the first
+ // request.
//
// Note that in this test the format completion signal will not be simulated,
// so the observer should not get FORMAT_COMPLETED signal.
{
InSequence s;
- EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED,
- chromeos::FORMAT_ERROR_UNKNOWN,
- "/device/source_path"))
- .Times(1);
-
EXPECT_CALL(observer_,
OnMountEvent(DiskMountManager::UNMOUNTING,
chromeos::MOUNT_ERROR_NONE,
@@ -369,6 +366,11 @@ TEST_F(DiskMountManagerTest, Format_ConcurrentFormatCalls) {
.Times(1);
EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED,
+ chromeos::FORMAT_ERROR_UNKNOWN,
+ "/device/source_path"))
+ .Times(1);
+
+ EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED,
chromeos::FORMAT_ERROR_NONE,
"/device/source_path"))
.Times(1);
« no previous file with comments | « chromeos/disks/disk_mount_manager.cc ('k') | chromeos/disks/mock_disk_mount_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698