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

Unified Diff: chromeos/disks/disk_mount_manager_unittest.cc

Issue 2273123003: Add comment to clarify what the mock action in the test does. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor revision of the comment. Created 4 years, 4 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 | « no previous file | no next file » | 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 8fe8d04ef5d2f39e78f91a2ce82c5191196bc619..e104750629944de22db7f010562278d0808636f4 100644
--- a/chromeos/disks/disk_mount_manager_unittest.cc
+++ b/chromeos/disks/disk_mount_manager_unittest.cc
@@ -661,18 +661,25 @@ TEST_F(DiskMountManagerTest, MountPath_RecordAccessMode) {
const std::string kMountPath1 = "/media/foo";
const std::string kMountPath2 = "/media/bar";
+ // Event handlers of observers should be called.
EXPECT_CALL(
observer_,
OnMountEvent(
DiskMountManager::MOUNTING, chromeos::MOUNT_ERROR_NONE,
Field(&DiskMountManager::MountPointInfo::mount_path, kMountPath1)));
- // Observers should see updated disks_ object reflecting mount option.
+ // For the 2nd source, the disk (block device) is not read-only but the
+ // test will mount it in read-only mode.
+ // Observers query |disks_| from |DiskMountManager| in its event handler for
+ // a mount completion event. Therefore |disks_| must be updated with correct
+ // |read_only| value before notifying to observers.
EXPECT_CALL(
observer_,
OnMountEvent(
DiskMountManager::MOUNTING, chromeos::MOUNT_ERROR_NONE,
Field(&DiskMountManager::MountPointInfo::mount_path, kMountPath2)))
.WillOnce(InvokeWithoutArgs(
+ // Verify if the disk appears read-only at the time of notification
+ // to observers.
[&]() { ExpectDiskReadOnly(manager, kSourcePath2, true); }));
manager->MountPath(kSourcePath1, kSourceFormat, std::string(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698