| Index: chrome/browser/chromeos/cros/mock_mount_library.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/cros/mock_mount_library.cc (revision 78562)
|
| +++ chrome/browser/chromeos/cros/mock_mount_library.cc (working copy)
|
| @@ -42,40 +42,71 @@
|
|
|
| void MockMountLibrary::FireDeviceInsertEvents() {
|
|
|
| + scoped_ptr<MountLibrary::Disk> disk1(new MountLibrary::Disk(
|
| + std::string(kTestDevicePath),
|
| + std::string(),
|
| + std::string(kTestSystemPath),
|
| + false,
|
| + true,
|
| + false));
|
| +
|
| disks_.clear();
|
| + disks_.insert(std::pair<std::string, MountLibrary::Disk*>(
|
| + std::string(kTestDevicePath), disk1.get()));
|
|
|
| - disks_.push_back(Disk(kTestDevicePath, "", kTestSystemPath, false, true));
|
| -
|
| // Device Added
|
| - chromeos::MountEventType evt;
|
| - evt = chromeos::DEVICE_ADDED;
|
| - UpdateMountStatus(evt, kTestSystemPath);
|
| + chromeos::MountLibraryEventType evt;
|
| + evt = chromeos::MOUNT_DEVICE_ADDED;
|
| + UpdateDeviceChanged(evt, kTestSystemPath);
|
|
|
| // Disk Added
|
| - evt = chromeos::DISK_ADDED;
|
| - UpdateMountStatus(evt, kTestDevicePath);
|
| + evt = chromeos::MOUNT_DISK_ADDED;
|
| + UpdateDiskChanged(evt, disk1.get());
|
|
|
| // Disk Changed
|
| + scoped_ptr<MountLibrary::Disk> disk2(new MountLibrary::Disk(
|
| + std::string(kTestDevicePath),
|
| + std::string(kTestMountPath),
|
| + std::string(kTestSystemPath),
|
| + false,
|
| + true,
|
| + false));
|
| disks_.clear();
|
| - disks_.push_back(Disk(
|
| - kTestDevicePath, kTestMountPath, kTestSystemPath, false, true));
|
| - evt = chromeos::DISK_CHANGED;
|
| - UpdateMountStatus(evt, kTestDevicePath);
|
| + disks_.insert(std::pair<std::string, MountLibrary::Disk*>(
|
| + std::string(kTestDevicePath), disk2.get()));
|
| + evt = chromeos::MOUNT_DISK_CHANGED;
|
| + UpdateDiskChanged(evt, disk2.get());
|
| }
|
|
|
| void MockMountLibrary::FireDeviceRemoveEvents() {
|
| + scoped_ptr<MountLibrary::Disk> disk(new MountLibrary::Disk(
|
| + std::string(kTestDevicePath),
|
| + std::string(kTestMountPath),
|
| + std::string(kTestSystemPath),
|
| + false,
|
| + true,
|
| + false));
|
| disks_.clear();
|
| - chromeos::MountEventType evt;
|
| - evt = chromeos::DISK_REMOVED;
|
| - UpdateMountStatus(evt, kTestDevicePath);
|
| + disks_.insert(std::pair<std::string, MountLibrary::Disk*>(
|
| + std::string(kTestDevicePath), disk.get()));
|
| + UpdateDiskChanged(chromeos::MOUNT_DISK_REMOVED, disk.get());
|
| }
|
|
|
| -void MockMountLibrary::UpdateMountStatus(MountEventType evt,
|
| - const std::string& path) {
|
| +void MockMountLibrary::UpdateDiskChanged(MountLibraryEventType evt,
|
| + const MountLibrary::Disk* disk) {
|
| // Make sure we run on UI thread.
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| - FOR_EACH_OBSERVER(Observer, observers_, MountChanged(this, evt, path));
|
| + FOR_EACH_OBSERVER(Observer, observers_, DiskChanged(evt, disk));
|
| }
|
|
|
| +
|
| +void MockMountLibrary::UpdateDeviceChanged(MountLibraryEventType evt,
|
| + const std::string& path) {
|
| + // Make sure we run on UI thread.
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| + FOR_EACH_OBSERVER(Observer, observers_, DeviceChanged(evt, path));
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|