Index: chrome/browser/storage_monitor/test_volume_mount_watcher_win.cc |
diff --git a/chrome/browser/storage_monitor/test_volume_mount_watcher_win.cc b/chrome/browser/storage_monitor/test_volume_mount_watcher_win.cc |
index 3dc2952b42a49583f90cb63760c2904030c3518d..35ad9c15119590b587adcf9535d501ec2ee4c557 100644 |
--- a/chrome/browser/storage_monitor/test_volume_mount_watcher_win.cc |
+++ b/chrome/browser/storage_monitor/test_volume_mount_watcher_win.cc |
@@ -8,6 +8,7 @@ |
#include "base/bind.h" |
#include "base/files/file_path.h" |
+#include "base/files/scoped_temp_dir.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/storage_monitor/storage_info.h" |
@@ -19,6 +20,17 @@ namespace { |
std::vector<base::FilePath> FakeGetSingleAttachedDevice() { |
std::vector<base::FilePath> result; |
result.push_back(VolumeMountWatcherWin::DriveNumberToFilePath(2)); // C |
+ |
+ // Make sure we are adding the drive on which ScopedTempDir will make |
+ // test directories. |
+ base::ScopedTempDir temp_dir; |
+ temp_dir.CreateUniqueTempDir(); |
+ base::FilePath temp_root = temp_dir.path(); |
+ while (temp_root.DirName() != temp_root) |
+ temp_root = temp_root.DirName(); |
+ if (temp_root != VolumeMountWatcherWin::DriveNumberToFilePath(2)) |
+ result.push_back(temp_root); |
+ |
return result; |
} |
@@ -49,6 +61,12 @@ bool GetMassStorageDeviceDetails(const base::FilePath& device_path, |
return false; |
} |
+ base::ScopedTempDir temp_dir; |
vandebo (ex-Chrome)
2013/05/28 16:10:43
nit: looks like this chunk could get pull into a h
Greg Billock
2013/05/29 17:23:59
Yeah, I pondered that. I'll go ahead and do it.
|
+ temp_dir.CreateUniqueTempDir(); |
+ base::FilePath temp_root = temp_dir.path(); |
+ while (temp_root.DirName() != temp_root) |
+ temp_root = temp_root.DirName(); |
+ |
if (info) { |
info->location = path.value(); |
info->total_size_in_bytes = 1000000; |
@@ -58,7 +76,8 @@ bool GetMassStorageDeviceDetails(const base::FilePath& device_path, |
unique_id[11] = device_path.value()[0]; |
chrome::StorageInfo::Type type = chrome::StorageInfo::FIXED_MASS_STORAGE; |
if (path.value() != ASCIIToUTF16("N:\\") && |
- path.value() != ASCIIToUTF16("C:\\")) { |
+ path.value() != ASCIIToUTF16("C:\\") && |
+ path.value() != temp_root.value()) { |
type = chrome::StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM; |
} |
info->device_id = chrome::StorageInfo::MakeDeviceId(type, unique_id); |