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

Unified Diff: chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc

Issue 12211084: [Media Galleries] Populate volume metadata in ChromeOS/Linux (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix linux problems Created 7 years, 9 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/storage_monitor/storage_monitor_linux_unittest.cc
diff --git a/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc b/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
index ae2f64825f3ec922394ca4bda7006f78bd8d092e..270e559bb79ef0745abefcd4d9866c485e4696b4 100644
--- a/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
+++ b/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
@@ -69,24 +69,36 @@ const TestDeviceData kTestDeviceData[] = {
};
void GetDeviceInfo(const base::FilePath& device_path,
- std::string* id,
+ const base::FilePath& mount_point,
+ std::string* device_id,
string16* name,
bool* removable,
- uint64* partition_size_in_bytes) {
+ uint64* partition_size_in_bytes,
+ string16* out_volume_label,
+ string16* out_vendor_name,
+ string16* out_model_name) {
for (size_t i = 0; i < arraysize(kTestDeviceData); i++) {
if (device_path.value() == kTestDeviceData[i].device_path) {
- if (id)
- *id = kTestDeviceData[i].unique_id;
if (name)
*name = ASCIIToUTF16(kTestDeviceData[i].device_name);
+ MediaStorageUtil::Type type = kTestDeviceData[i].type;
if (removable) {
- MediaStorageUtil::Type type = kTestDeviceData[i].type;
*removable =
(type == MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM) ||
(type == MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM);
}
+ if (device_id) {
+ *device_id =
+ MediaStorageUtil::MakeDeviceId(type, kTestDeviceData[i].unique_id);
+ }
if (partition_size_in_bytes)
*partition_size_in_bytes = kTestDeviceData[i].partition_size_in_bytes;
+ if (out_volume_label)
+ *out_volume_label = ASCIIToUTF16("volume label");
+ if (out_vendor_name)
+ *out_vendor_name = ASCIIToUTF16("vendor name");
+ if (out_model_name)
+ *out_model_name = ASCIIToUTF16("model name");
return;
}
}
@@ -605,7 +617,7 @@ TEST_F(StorageMonitorLinuxTest, DeviceLookUp) {
ASSERT_FALSE(test_path_c.empty());
// Attach to one first.
- // (*'d mounts are those StorageMonitor knows about.)
+ // (starred mounts are those StorageMonitor knows about.)
// kDeviceDCIM1 -> kMountPointA *
// kDeviceNoDCIM -> kMountPointB *
// kDeviceFixed -> kMountPointC
@@ -623,6 +635,10 @@ TEST_F(StorageMonitorLinuxTest, DeviceLookUp) {
EXPECT_EQ(GetDeviceId(kDeviceDCIM1), device_info.device_id);
EXPECT_EQ(test_path_a.value(), device_info.location);
EXPECT_EQ(GetDeviceName(kDeviceDCIM1), device_info.name);
+ EXPECT_EQ(88788ULL, device_info.total_size_in_bytes);
+ EXPECT_EQ(ASCIIToUTF16("volume label"), device_info.storage_label);
+ EXPECT_EQ(ASCIIToUTF16("vendor name"), device_info.vendor_name);
+ EXPECT_EQ(ASCIIToUTF16("model name"), device_info.model_name);
EXPECT_TRUE(notifier()->GetStorageInfoForPath(test_path_b, &device_info));
EXPECT_EQ(GetDeviceId(kDeviceNoDCIM), device_info.device_id);

Powered by Google App Engine
This is Rietveld 408576698