| 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 // MediaFileSystemRegistry unit tests. | 5 // MediaFileSystemRegistry unit tests. |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 return device_id; | 521 return device_id; |
| 522 } | 522 } |
| 523 | 523 |
| 524 std::string MediaFileSystemRegistryTest::AttachDevice( | 524 std::string MediaFileSystemRegistryTest::AttachDevice( |
| 525 MediaStorageUtil::Type type, | 525 MediaStorageUtil::Type type, |
| 526 const std::string& unique_id, | 526 const std::string& unique_id, |
| 527 const FilePath& location) { | 527 const FilePath& location) { |
| 528 std::string device_id = MediaStorageUtil::MakeDeviceId(type, unique_id); | 528 std::string device_id = MediaStorageUtil::MakeDeviceId(type, unique_id); |
| 529 DCHECK(MediaStorageUtil::IsRemovableDevice(device_id)); | 529 DCHECK(MediaStorageUtil::IsRemovableDevice(device_id)); |
| 530 string16 name = location.LossyDisplayName(); | 530 string16 name = location.LossyDisplayName(); |
| 531 base::SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, name, | 531 RemovableStorageNotifications::GetInstance()-> |
| 532 location.value()); | 532 ProcessRemovableStorageAttached(device_id, name, location.value()); |
| 533 MessageLoop::current()->RunUntilIdle(); | 533 MessageLoop::current()->RunUntilIdle(); |
| 534 return device_id; | 534 return device_id; |
| 535 } | 535 } |
| 536 | 536 |
| 537 void MediaFileSystemRegistryTest::DetachDevice(const std::string& device_id) { | 537 void MediaFileSystemRegistryTest::DetachDevice(const std::string& device_id) { |
| 538 DCHECK(MediaStorageUtil::IsRemovableDevice(device_id)); | 538 DCHECK(MediaStorageUtil::IsRemovableDevice(device_id)); |
| 539 base::SystemMonitor::Get()->ProcessRemovableStorageDetached(device_id); | 539 RemovableStorageNotifications::GetInstance()-> |
| 540 ProcessRemovableStorageDetached(device_id); |
| 540 MessageLoop::current()->RunUntilIdle(); | 541 MessageLoop::current()->RunUntilIdle(); |
| 541 } | 542 } |
| 542 | 543 |
| 543 void MediaFileSystemRegistryTest::SetGalleryPermission( | 544 void MediaFileSystemRegistryTest::SetGalleryPermission( |
| 544 ProfileState* profile_state, extensions::Extension* extension, | 545 ProfileState* profile_state, extensions::Extension* extension, |
| 545 const std::string& device_id, bool has_access) { | 546 const std::string& device_id, bool has_access) { |
| 546 MediaGalleriesPreferences* preferences = | 547 MediaGalleriesPreferences* preferences = |
| 547 profile_state->GetMediaGalleriesPrefs(); | 548 profile_state->GetMediaGalleriesPrefs(); |
| 548 MediaGalleryPrefIdSet pref_id = | 549 MediaGalleryPrefIdSet pref_id = |
| 549 preferences->LookUpGalleriesByDeviceId(device_id); | 550 preferences->LookUpGalleriesByDeviceId(device_id); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 device_id, | 667 device_id, |
| 667 true /*has access*/); | 668 true /*has access*/); |
| 668 auto_galleries.push_back(added_info); | 669 auto_galleries.push_back(added_info); |
| 669 profile_state->CheckGalleries("user added all", added_galleries, | 670 profile_state->CheckGalleries("user added all", added_galleries, |
| 670 auto_galleries); | 671 auto_galleries); |
| 671 } | 672 } |
| 672 | 673 |
| 673 } // namespace | 674 } // namespace |
| 674 | 675 |
| 675 } // namespace chrome | 676 } // namespace chrome |
| OLD | NEW |