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

Side by Side Diff: chrome/browser/chromeos/file_manager/volume_manager_unittest.cc

Issue 2348813002: Fix a bug that unmounting devices on the policy update can be a busy loop. (Closed)
Patch Set: Eliminate unrelated and unnecessary change. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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/volume_manager.h" 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 volume_manager()->OnExternalStorageDisabledChanged(); 715 volume_manager()->OnExternalStorageDisabledChanged();
716 716
717 // Expect no effects. 717 // Expect no effects.
718 EXPECT_EQ(2U, disk_mount_manager_->mount_points().size()); 718 EXPECT_EQ(2U, disk_mount_manager_->mount_points().size());
719 EXPECT_EQ(0U, disk_mount_manager_->unmount_requests().size()); 719 EXPECT_EQ(0U, disk_mount_manager_->unmount_requests().size());
720 720
721 // Emulate to set kExternalStorageDisabled to true. 721 // Emulate to set kExternalStorageDisabled to true.
722 profile()->GetPrefs()->SetBoolean(prefs::kExternalStorageDisabled, true); 722 profile()->GetPrefs()->SetBoolean(prefs::kExternalStorageDisabled, true);
723 volume_manager()->OnExternalStorageDisabledChanged(); 723 volume_manager()->OnExternalStorageDisabledChanged();
724 724
725 // Wait until all unmount request finishes, so that callback chain to unmount
726 // all the mount points will be invoked.
727 disk_mount_manager_->FinishAllUnmountPathRequests();
728
725 // The all mount points should be unmounted. 729 // The all mount points should be unmounted.
726 EXPECT_EQ(0U, disk_mount_manager_->mount_points().size()); 730 EXPECT_EQ(0U, disk_mount_manager_->mount_points().size());
727 731
728 EXPECT_EQ(2U, disk_mount_manager_->unmount_requests().size()); 732 EXPECT_EQ(2U, disk_mount_manager_->unmount_requests().size());
729 const FakeDiskMountManager::UnmountRequest& unmount_request1 = 733 const FakeDiskMountManager::UnmountRequest& unmount_request1 =
730 disk_mount_manager_->unmount_requests()[0]; 734 disk_mount_manager_->unmount_requests()[0];
731 EXPECT_EQ("mount1", unmount_request1.mount_path); 735 EXPECT_EQ("mount1", unmount_request1.mount_path);
732 736
733 const FakeDiskMountManager::UnmountRequest& unmount_request2 = 737 const FakeDiskMountManager::UnmountRequest& unmount_request2 =
734 disk_mount_manager_->unmount_requests()[1]; 738 disk_mount_manager_->unmount_requests()[1];
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 // Detach 904 // Detach
901 volume_manager()->OnRemovableStorageDetached(info); 905 volume_manager()->OnRemovableStorageDetached(info);
902 ASSERT_EQ(2u, observer.events().size()); 906 ASSERT_EQ(2u, observer.events().size());
903 EXPECT_EQ(LoggingObserver::Event::VOLUME_UNMOUNTED, 907 EXPECT_EQ(LoggingObserver::Event::VOLUME_UNMOUNTED,
904 observer.events()[1].type); 908 observer.events()[1].type);
905 909
906 EXPECT_FALSE(volume.get()); 910 EXPECT_FALSE(volume.get());
907 } 911 }
908 912
909 } // namespace file_manager 913 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698