Index: chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc |
=================================================================== |
--- chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc (revision 146883) |
+++ chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc (working copy) |
@@ -18,6 +18,7 @@ |
#include "base/scoped_temp_dir.h" |
#include "base/system_monitor/system_monitor.h" |
#include "base/test/mock_devices_changed_observer.h" |
+#include "base/utf_string_conversions.h" |
#include "content/public/test/test_browser_thread.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -236,7 +237,11 @@ |
MtabTestData(kDevice2, test_path.value(), kValidFS), |
}; |
// Only |kDevice2| should be attached, since |kDevice1| has a bad path. |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(0, kDevice2, test_path)) |
+ EXPECT_CALL(observer(), |
+ OnMediaDeviceAttached(0, |
+ kDevice2, |
+ base::SystemMonitor::TYPE_PATH, |
+ UTF8ToUTF16(test_path.value()))) |
.InSequence(mock_sequence); |
AppendToMtabAndRunLoop(test_data, arraysize(test_data)); |
@@ -254,7 +259,11 @@ |
MtabTestData(kDevice1, test_path_a.value(), kValidFS), |
}; |
// |kDevice1| should be attached as expected. |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(0, kDevice1, test_path_a)) |
+ EXPECT_CALL(observer(), |
+ OnMediaDeviceAttached(0, |
+ kDevice1, |
+ base::SystemMonitor::TYPE_PATH, |
+ UTF8ToUTF16(test_path_a.value()))) |
.InSequence(mock_sequence); |
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1)); |
@@ -285,7 +294,7 @@ |
MtabTestData(kDevice1, test_path_a.value(), kValidFS), |
MtabTestData(kDevice2, test_path_b.value(), kValidFS), |
}; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(2); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(2); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(0); |
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1)); |
@@ -298,7 +307,7 @@ |
MtabTestData test_data2[] = { |
MtabTestData(kDevice1, test_path_b.value(), kValidFS), |
}; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(1); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(1); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(2); |
AppendToMtabAndRunLoop(test_data2, arraysize(test_data2)); |
@@ -310,7 +319,7 @@ |
MtabTestData test_data3[] = { |
MtabTestData(kDevice2, test_path_a.value(), kValidFS), |
}; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(1); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(1); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(0); |
AppendToMtabAndRunLoop(test_data3, arraysize(test_data3)); |
@@ -323,19 +332,19 @@ |
MtabTestData(kDevice2, test_path_b.value(), kValidFS), |
MtabTestData(kDevice1, test_path_b.value(), kValidFS), |
}; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(1); |
OverwriteMtabAndRunLoop(test_data4, arraysize(test_data4)); |
// Detach |kDevice1| from |kMountPointB|. |
// kDevice1 -> kMountPointA |
// kDevice2 -> kMountPointB |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(2); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(2); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(1); |
OverwriteMtabAndRunLoop(test_data1, arraysize(test_data1)); |
// Detach all devices. |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(2); |
WriteEmptyMtabAndRunLoop(); |
} |
@@ -344,6 +353,7 @@ |
TEST_F(MediaDeviceNotificationsLinuxTest, MultiDevicesOneMountPoint) { |
FilePath test_path_a = CreateMountPointWithDCIMDir(kMountPointA); |
FilePath test_path_b = CreateMountPointWithDCIMDir(kMountPointB); |
+ string16 test_path_b_str16 = UTF8ToUTF16(test_path_b.value()); |
ASSERT_FALSE(test_path_a.empty()); |
ASSERT_FALSE(test_path_b.empty()); |
@@ -356,7 +366,11 @@ |
MtabTestData(kDevice2, test_path_b.value(), kValidFS), |
MtabTestData(kDevice1, test_path_b.value(), kValidFS), |
}; |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(0, kDevice1, test_path_b)) |
+ EXPECT_CALL(observer(), |
+ OnMediaDeviceAttached(0, |
+ kDevice1, |
+ base::SystemMonitor::TYPE_PATH, |
+ test_path_b_str16)) |
.Times(1); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(0); |
OverwriteMtabAndRunLoop(test_data1, arraysize(test_data1)); |
@@ -373,12 +387,16 @@ |
MtabTestData(kDevice3, test_path_b.value(), kValidFS), |
}; |
EXPECT_CALL(observer(), OnMediaDeviceDetached(0)).Times(1); |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(1, kDevice3, test_path_b)) |
+ EXPECT_CALL(observer(), |
+ OnMediaDeviceAttached(1, |
+ kDevice3, |
+ base::SystemMonitor::TYPE_PATH, |
+ test_path_b_str16)) |
.Times(1); |
AppendToMtabAndRunLoop(test_data2, arraysize(test_data2)); |
// Detach all devices. |
- EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
+ EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
EXPECT_CALL(observer(), OnMediaDeviceDetached(1)).Times(1); |
WriteEmptyMtabAndRunLoop(); |
} |