Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1734)

Unified Diff: chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc

Issue 10780023: Change base::SystemMonitor's media device functions to take a type and string16 instead of a FilePa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix win Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698