| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/disks/mock_disk_mount_manager.h" | 5 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "content/public/browser/browser_thread.h" | |
| 13 | 12 |
| 14 using content::BrowserThread; | |
| 15 using testing::_; | 13 using testing::_; |
| 16 using testing::AnyNumber; | 14 using testing::AnyNumber; |
| 17 using testing::Invoke; | 15 using testing::Invoke; |
| 18 using testing::ReturnRef; | 16 using testing::ReturnRef; |
| 19 | 17 |
| 20 namespace chromeos { | 18 namespace chromeos { |
| 21 namespace disks { | 19 namespace disks { |
| 22 | 20 |
| 23 namespace { | 21 namespace { |
| 24 | 22 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 const DiskMountManager::Disk* | 208 const DiskMountManager::Disk* |
| 211 MockDiskMountManager::FindDiskBySourcePathInternal( | 209 MockDiskMountManager::FindDiskBySourcePathInternal( |
| 212 const std::string& source_path) const { | 210 const std::string& source_path) const { |
| 213 DiskMap::const_iterator disk_it = disks_.find(source_path); | 211 DiskMap::const_iterator disk_it = disks_.find(source_path); |
| 214 return disk_it == disks_.end() ? NULL : disk_it->second; | 212 return disk_it == disks_.end() ? NULL : disk_it->second; |
| 215 } | 213 } |
| 216 | 214 |
| 217 void MockDiskMountManager::NotifyDiskChanged( | 215 void MockDiskMountManager::NotifyDiskChanged( |
| 218 DiskMountManagerEventType event, | 216 DiskMountManagerEventType event, |
| 219 const DiskMountManager::Disk* disk) { | 217 const DiskMountManager::Disk* disk) { |
| 220 // Make sure we run on UI thread. | |
| 221 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 222 | |
| 223 FOR_EACH_OBSERVER(Observer, observers_, DiskChanged(event, disk)); | 218 FOR_EACH_OBSERVER(Observer, observers_, DiskChanged(event, disk)); |
| 224 } | 219 } |
| 225 | 220 |
| 226 void MockDiskMountManager::NotifyDeviceChanged(DiskMountManagerEventType event, | 221 void MockDiskMountManager::NotifyDeviceChanged(DiskMountManagerEventType event, |
| 227 const std::string& path) { | 222 const std::string& path) { |
| 228 // Make sure we run on UI thread. | |
| 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 230 | |
| 231 FOR_EACH_OBSERVER(Observer, observers_, DeviceChanged(event, path)); | 223 FOR_EACH_OBSERVER(Observer, observers_, DeviceChanged(event, path)); |
| 232 } | 224 } |
| 233 | 225 |
| 234 } // namespace disks | 226 } // namespace disks |
| 235 } // namespace chromeos | 227 } // namespace chromeos |
| OLD | NEW |