Index: chrome/browser/media_gallery/media_device_notifications_chromeos_unittest.cc |
diff --git a/chrome/browser/media_gallery/media_device_notifications_chromeos_unittest.cc b/chrome/browser/media_gallery/media_device_notifications_chromeos_unittest.cc |
index 4a20b7afcc34303c9908267894d19b4df882b172..d701c2a8df908d868897de34922d86c21e3644e8 100644 |
--- a/chrome/browser/media_gallery/media_device_notifications_chromeos_unittest.cc |
+++ b/chrome/browser/media_gallery/media_device_notifications_chromeos_unittest.cc |
@@ -15,6 +15,7 @@ |
#include "base/test/mock_devices_changed_observer.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" |
+#include "chrome/browser/media_gallery/media_storage_util.h" |
#include "content/public/test/test_browser_thread.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -33,6 +34,11 @@ const char kDevice2Name[] = "d2"; |
const char kMountPointA[] = "mnt_a"; |
const char kMountPointB[] = "mnt_b"; |
+std::string GetDCIMDeviceId(std::string unique_id) { |
kmadhusu
2012/08/20 17:13:50
nit: const std::string&
vandebo (ex-Chrome)
2012/08/20 18:35:14
Done.
|
+ return chrome::MediaStorageUtil::MakeDeviceId( |
+ chrome::MediaStorageUtil::USB_MASS_STORAGE_WITH_DCIM, unique_id); |
+} |
+ |
class MediaDeviceNotificationsTest : public testing::Test { |
public: |
MediaDeviceNotificationsTest() |
@@ -74,10 +80,10 @@ class MediaDeviceNotificationsTest : public testing::Test { |
void MountDevice(MountError error_code, |
const DiskMountManager::MountPointInfo& mount_info, |
- const std::string& device_id) { |
+ const std::string& unique_id) { |
if (error_code == MOUNT_ERROR_NONE) { |
disk_mount_manager_mock_->CreateDiskEntryForMountDevice( |
- mount_info, device_id); |
+ mount_info, unique_id); |
} |
notifications_->MountCompleted(disks::DiskMountManager::MOUNTING, |
error_code, |
@@ -155,11 +161,10 @@ TEST_F(MediaDeviceNotificationsTest, BasicAttachDetach) { |
mount_path1.value(), |
MOUNT_TYPE_DEVICE, |
disks::MOUNT_CONDITION_NONE); |
- const std::string kDeviceId0 = "FFFF-FFFF"; |
+ const std::string kDeviceId0 = GetDCIMDeviceId("FFFF-FFFF"); |
EXPECT_CALL(observer(), |
OnMediaDeviceAttached(kDeviceId0, |
ASCIIToUTF16(kDevice1Name), |
- base::SystemMonitor::TYPE_PATH, |
mount_path1.value())) |
.InSequence(mock_sequence); |
MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId0); |
@@ -174,12 +179,11 @@ TEST_F(MediaDeviceNotificationsTest, BasicAttachDetach) { |
mount_path2.value(), |
MOUNT_TYPE_DEVICE, |
disks::MOUNT_CONDITION_NONE); |
- const std::string kDeviceId1 = "FFF0-FFF0"; |
+ const std::string kDeviceId1 = GetDCIMDeviceId("FFF0-FFF0"); |
EXPECT_CALL(observer(), |
OnMediaDeviceAttached(kDeviceId1, |
ASCIIToUTF16(kDevice2Name), |
- base::SystemMonitor::TYPE_PATH, |
mount_path2.value())) |
.InSequence(mock_sequence); |
MountDevice(MOUNT_ERROR_NONE, mount_info2, kDeviceId1); |
@@ -193,13 +197,13 @@ TEST_F(MediaDeviceNotificationsTest, BasicAttachDetach) { |
TEST_F(MediaDeviceNotificationsTest, DCIM) { |
testing::Sequence mock_sequence; |
FilePath mount_path = CreateMountPoint(kMountPointA, false); |
- const std::string kDeviceId = "FFFF-FFFF"; |
+ const std::string kDeviceId = GetDCIMDeviceId("FFFF-FFFF"); |
ASSERT_FALSE(mount_path.empty()); |
DiskMountManager::MountPointInfo mount_info(kDevice1, |
mount_path.value(), |
MOUNT_TYPE_DEVICE, |
disks::MOUNT_CONDITION_NONE); |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId); |
} |
@@ -207,7 +211,7 @@ TEST_F(MediaDeviceNotificationsTest, DCIM) { |
TEST_F(MediaDeviceNotificationsTest, Ignore) { |
testing::Sequence mock_sequence; |
FilePath mount_path = CreateMountPoint(kMountPointA, true); |
- const std::string kDeviceId = "FFFF-FFFF"; |
+ const std::string kDeviceId = GetDCIMDeviceId("FFFF-FFFF"); |
ASSERT_FALSE(mount_path.empty()); |
// Mount error. |
@@ -215,18 +219,18 @@ TEST_F(MediaDeviceNotificationsTest, Ignore) { |
mount_path.value(), |
MOUNT_TYPE_DEVICE, |
disks::MOUNT_CONDITION_NONE); |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
MountDevice(MOUNT_ERROR_UNKNOWN, mount_info, kDeviceId); |
// Not a device |
mount_info.mount_type = MOUNT_TYPE_ARCHIVE; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId); |
// Unsupported file system. |
mount_info.mount_type = MOUNT_TYPE_DEVICE; |
mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId); |
} |