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

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: Fix syntax 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 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 =
« 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