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 b3c8a8f2b0e54ac7eeb4d3b0c17e16d8fdbfae2b..3d04487ca835001a08c8b7a3c56fdc80fc16126e 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" |
@@ -16,9 +17,25 @@ namespace test { |
namespace { |
+base::FilePath GetTempRoot() { |
+ 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(); |
+ return temp_root; |
+} |
+ |
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::FilePath temp_root = GetTempRoot(); |
+ if (temp_root != VolumeMountWatcherWin::DriveNumberToFilePath(2)) |
+ result.push_back(temp_root); |
+ |
return result; |
} |
@@ -51,7 +68,8 @@ bool GetMassStorageDeviceDetails(const base::FilePath& device_path, |
StorageInfo::Type type = StorageInfo::FIXED_MASS_STORAGE; |
if (path.value() != ASCIIToUTF16("N:\\") && |
- path.value() != ASCIIToUTF16("C:\\")) { |
+ path.value() != ASCIIToUTF16("C:\\") && |
+ path.value() != GetTempRoot().value()) { |
type = StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM; |
} |
std::string unique_id = |