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

Unified Diff: chrome/browser/system_monitor/removable_device_notifications_window_win_unittest.cc

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 8 years, 2 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/system_monitor/removable_device_notifications_window_win_unittest.cc
diff --git a/chrome/browser/system_monitor/removable_device_notifications_window_win_unittest.cc b/chrome/browser/system_monitor/removable_device_notifications_window_win_unittest.cc
index 7288899df4cadb9c23dfbd9be6808d7b90998aaf..937cd875eab01ee4e295ffe6ee302c0a934281a5 100644
--- a/chrome/browser/system_monitor/removable_device_notifications_window_win_unittest.cc
+++ b/chrome/browser/system_monitor/removable_device_notifications_window_win_unittest.cc
@@ -326,6 +326,13 @@ class RemovableDeviceNotificationsWindowWinTest : public testing::Test {
// |test_attach|) and tests that the appropriate handler is called.
void DoMTPDeviceTest(const string16& pnp_device_id, bool test_attach);
+ // Gets the MTP details of the storage specified by the |storage_unique_id|.
+ // On success, returns true and fills in |pnp_device_id| and
+ // |storage_object_id|.
+ bool GetMTPStorageInfo(const std::string& storage_unique_id,
+ string16* pnp_device_id,
+ string16* storage_object_id);
+
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
@@ -491,6 +498,15 @@ void RemovableDeviceNotificationsWindowWinTest::DoMTPDeviceTest(
RunAllPending();
}
+bool RemovableDeviceNotificationsWindowWinTest::GetMTPStorageInfo(
+ const std::string& storage_unique_id,
+ string16* pnp_device_id,
+ string16* storage_object_id) {
+ return window_->GetMTPStorageInfoFromUniqueId(storage_unique_id,
+ pnp_device_id,
+ storage_object_id);
+}
+
TEST_F(RemovableDeviceNotificationsWindowWinTest, RandomMessage) {
window_->InjectDeviceChange(DBT_DEVICEQUERYREMOVE, NULL);
RunAllPending();
@@ -642,4 +658,24 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest,
DoMTPDeviceTest(kMTPDeviceWithMultipleStorageObjects, false);
}
+// Given a MTP storage persistent id, GetMTPStorageInfo() should fetch the
+// device interface path and local storage object identifier.
+TEST_F(RemovableDeviceNotificationsWindowWinTest, GetMTPStorageInfo) {
+ DoMTPDeviceTest(kMTPDeviceWithValidInfo, true);
+
+ PortableDeviceWatcherWin::StorageObjects storage_objects =
+ GetDeviceStorageObjects(kMTPDeviceWithValidInfo);
+ for (PortableDeviceWatcherWin::StorageObjects::const_iterator it =
+ storage_objects.begin(); it != storage_objects.end(); ++it) {
+ string16 pnp_device_id;
+ string16 storage_object_id;
+ ASSERT_TRUE(GetMTPStorageInfo(it->object_persistent_id, &pnp_device_id,
+ &storage_object_id));
+ EXPECT_EQ(kMTPDeviceWithValidInfo, pnp_device_id);
+ EXPECT_EQ(it->object_persistent_id,
+ GetMTPStorageUniqueId(pnp_device_id, storage_object_id));
+ }
+ DoMTPDeviceTest(kMTPDeviceWithValidInfo, false);
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698