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

Unified Diff: chrome/browser/chromeos/file_manager/volume_manager_unittest.cc

Issue 490643005: Files.app: Start to use DeviceEventRouter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 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
Index: chrome/browser/chromeos/file_manager/volume_manager_unittest.cc
diff --git a/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc b/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc
index c859317844e605df11c8da87ba70414b38c62ec6..92c308d9602606dc31724ce2f4814221eb505659 100644
--- a/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc
@@ -38,7 +38,6 @@ class LoggingObserver : public VolumeManagerObserver {
VOLUME_UNMOUNTED,
FORMAT_STARTED,
FORMAT_COMPLETED,
- HARD_UNPLUGGED,
} type;
// Available on DEVICE_ADDED, DEVICE_REMOVED, VOLUME_MOUNTED,
@@ -115,13 +114,6 @@ class LoggingObserver : public VolumeManagerObserver {
events_.push_back(event);
}
- virtual void OnHardUnplugged(const std::string& device_path) OVERRIDE {
- Event event;
- event.type = Event::HARD_UNPLUGGED;
- event.device_path = device_path;
- events_.push_back(event);
- }
-
virtual void OnFormatStarted(
const std::string& device_path, bool success) OVERRIDE {
Event event;
@@ -389,15 +381,11 @@ TEST_F(VolumeManagerTest, OnDiskEvent_Removed) {
volume_manager()->OnDiskEvent(
chromeos::disks::DiskMountManager::DISK_REMOVED, &kMountedDisk);
- ASSERT_EQ(2U, observer.events().size());
+ ASSERT_EQ(1U, observer.events().size());
const LoggingObserver::Event& event = observer.events()[0];
EXPECT_EQ(LoggingObserver::Event::DISK_REMOVED, event.type);
EXPECT_EQ("device1", event.device_path);
- // Since the Disk has non-empty mount_path, it's regarded as hard unplugging.
- EXPECT_EQ(LoggingObserver::Event::HARD_UNPLUGGED,
- observer.events()[1].type);
-
ASSERT_EQ(1U, disk_mount_manager_->unmount_requests().size());
const FakeDiskMountManager::UnmountRequest& unmount_request =
disk_mount_manager_->unmount_requests()[0];
@@ -838,74 +826,6 @@ TEST_F(VolumeManagerTest, ArchiveSourceFiltering) {
EXPECT_EQ(3u, observer.events().size());
}
-TEST_F(VolumeManagerTest, HardUnplugged) {
- volume_manager()->Initialize();
- LoggingObserver observer;
- volume_manager()->AddObserver(&observer);
-
- // Disk that has a mount path is removed.
- chromeos::disks::DiskMountManager::Disk mounted_disk(
- "device1",
- "/mount/path",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "uuid1",
- "device1",
- chromeos::DEVICE_TYPE_UNKNOWN,
- 0,
- false,
- false,
- false,
- false,
- false,
- false);
-
- chromeos::disks::DiskMountManager::Disk unmounted_disk(
- "device2",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "uuid2",
- "device2",
- chromeos::DEVICE_TYPE_UNKNOWN,
- 0,
- false,
- false,
- false,
- false,
- false,
- false);
-
- // Do not publish the hard_unplugged event for a disk that is already
- // unmounted.
- disk_mount_manager_->InvokeDiskEventForTest(
- chromeos::disks::DiskMountManager::DISK_REMOVED, &unmounted_disk);
- // Publish the hard_unplugged event for a disk that is currently mounted.
- disk_mount_manager_->InvokeDiskEventForTest(
- chromeos::disks::DiskMountManager::DISK_REMOVED, &mounted_disk);
- // Do not publish the hard_unplugged event twice for the same disk.
- disk_mount_manager_->InvokeDiskEventForTest(
- chromeos::disks::DiskMountManager::DISK_REMOVED, &mounted_disk);
-
- EXPECT_EQ(4u, observer.events().size());
- EXPECT_EQ(LoggingObserver::Event::DISK_REMOVED, observer.events()[0].type);
- EXPECT_EQ(LoggingObserver::Event::DISK_REMOVED, observer.events()[1].type);
- EXPECT_EQ(LoggingObserver::Event::HARD_UNPLUGGED, observer.events()[2].type);
- EXPECT_EQ(LoggingObserver::Event::DISK_REMOVED, observer.events()[3].type);
-}
-
TEST_F(VolumeManagerTest, MTPPlugAndUnplug) {
LoggingObserver observer;
volume_manager()->AddObserver(&observer);
« no previous file with comments | « chrome/browser/chromeos/file_manager/volume_manager_observer.h ('k') | chrome/common/extensions/api/file_browser_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698