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

Unified Diff: components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc

Issue 287613002: Fill |model_name| and |vendor_name| fields of StorageInfo for MTP devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test for the newly filled members. Created 6 years, 7 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
« no previous file with comments | « components/storage_monitor/media_transfer_protocol_device_observer_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc b/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
index b1865ca41b2593129564ccef7aff5033c31e457a..af9987c3c477cedbf7e198c1bd0341cbf36840ff 100644
--- a/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
+++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
@@ -29,6 +29,8 @@ const char kStorageLocation[] = "/usb:2,2,88888";
const char kStorageUniqueId[] = "VendorModelSerial:COM:MOD2012:283";
const char kStorageWithInvalidInfo[] = "usb:2,3,11111";
const char kStorageWithValidInfo[] = "usb:2,2,88888";
+const char kStorageVendor[] = "ExampleVendor";
+const char kStorageProductName[] = "ExampleCamera";
// Returns the mtp device id given the |unique_id|.
std::string GetMtpDeviceId(const std::string& unique_id) {
@@ -36,12 +38,15 @@ std::string GetMtpDeviceId(const std::string& unique_id) {
}
// Helper function to get the device storage details such as device id, label
-// and location. On success, fills in |id|, |label| and |location|.
+// and location. On success, fills in |id|, |label|, |location|, |vendor_name|,
+// and |product_name|.
void GetStorageInfo(const std::string& storage_name,
device::MediaTransferProtocolManager* mtp_manager,
std::string* id,
base::string16* label,
- std::string* location) {
+ std::string* location,
+ base::string16* vendor_name,
+ base::string16* product_name) {
if (storage_name == kStorageWithInvalidInfo)
return; // Do not set any storage details.
@@ -50,6 +55,8 @@ void GetStorageInfo(const std::string& storage_name,
*id = GetMtpDeviceId(kStorageUniqueId);
*label = base::ASCIIToUTF16(kStorageLabel);
*location = kStorageLocation;
+ *vendor_name = base::ASCIIToUTF16(kStorageVendor);
+ *product_name = base::ASCIIToUTF16(kStorageProductName);
}
class TestMediaTransferProtocolDeviceObserverLinux
@@ -137,6 +144,10 @@ TEST_F(MediaTransferProtocolDeviceObserverLinuxTest, BasicAttachDetach) {
EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(device_id, observer().last_attached().device_id());
EXPECT_EQ(kStorageLocation, observer().last_attached().location());
+ EXPECT_EQ(base::ASCIIToUTF16(kStorageVendor),
+ observer().last_attached().vendor_name());
+ EXPECT_EQ(base::ASCIIToUTF16(kStorageProductName),
+ observer().last_attached().model_name());
// Detach the attached storage.
mtp_device_observer()->MtpStorageDetached(kStorageWithValidInfo);
« no previous file with comments | « components/storage_monitor/media_transfer_protocol_device_observer_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698