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

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

Issue 15767005: [MediaGalleries] Add temp dir adjustment in windows unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « chrome/browser/storage_monitor/storage_monitor_win_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698