Index: chrome/browser/storage_monitor/storage_monitor_win_unittest.cc |
diff --git a/chrome/browser/storage_monitor/removable_device_notifications_window_win_unittest.cc b/chrome/browser/storage_monitor/storage_monitor_win_unittest.cc |
similarity index 88% |
rename from chrome/browser/storage_monitor/removable_device_notifications_window_win_unittest.cc |
rename to chrome/browser/storage_monitor/storage_monitor_win_unittest.cc |
index 5f40a80a68fbf56e7232950ace58e9439dd4b52e..b7cd06c4568dcdb13920fec41ca9cbf76acb07a4 100644 |
--- a/chrome/browser/storage_monitor/removable_device_notifications_window_win_unittest.cc |
+++ b/chrome/browser/storage_monitor/storage_monitor_win_unittest.cc |
@@ -17,9 +17,9 @@ |
#include "chrome/browser/storage_monitor/mock_removable_storage_observer.h" |
#include "chrome/browser/storage_monitor/portable_device_watcher_win.h" |
#include "chrome/browser/storage_monitor/removable_device_constants.h" |
-#include "chrome/browser/storage_monitor/removable_device_notifications_window_win.h" |
+#include "chrome/browser/storage_monitor/storage_monitor_win.h" |
#include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h" |
-#include "chrome/browser/storage_monitor/test_removable_device_notifications_window_win.h" |
+#include "chrome/browser/storage_monitor/test_storage_monitor_win.h" |
#include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" |
#include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" |
#include "content/public/test/test_browser_thread.h" |
@@ -32,12 +32,12 @@ using content::BrowserThread; |
typedef std::vector<int> DeviceIndices; |
-// RemovableDeviceNotificationsWindowWinTest ----------------------------------- |
+// StorageMonitorWindowWinTest ----------------------------------- |
-class RemovableDeviceNotificationsWindowWinTest : public testing::Test { |
+class StorageMonitorWindowWinTest : public testing::Test { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
StorageMonitorWinTest
|
public: |
- RemovableDeviceNotificationsWindowWinTest(); |
- virtual ~RemovableDeviceNotificationsWindowWinTest(); |
+ StorageMonitorWindowWinTest(); |
+ virtual ~StorageMonitorWindowWinTest(); |
protected: |
// testing::Test: |
@@ -63,7 +63,7 @@ class RemovableDeviceNotificationsWindowWinTest : public testing::Test { |
string16* pnp_device_id, |
string16* storage_object_id); |
- scoped_ptr<TestRemovableDeviceNotificationsWindowWin> window_; |
+ scoped_ptr<TestStorageMonitorWindowWin> window_; |
// Weak pointer; owned by the device notifications class. |
TestVolumeMountWatcherWin* volume_mount_watcher_; |
@@ -76,32 +76,32 @@ class RemovableDeviceNotificationsWindowWinTest : public testing::Test { |
content::TestBrowserThread file_thread_; |
}; |
-RemovableDeviceNotificationsWindowWinTest:: |
- RemovableDeviceNotificationsWindowWinTest() |
+StorageMonitorWindowWinTest:: |
+ StorageMonitorWindowWinTest() |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
: ui_thread_(BrowserThread::UI, &message_loop_), |
file_thread_(BrowserThread::FILE, &message_loop_) { |
} |
-RemovableDeviceNotificationsWindowWinTest:: |
- ~RemovableDeviceNotificationsWindowWinTest() { |
+StorageMonitorWindowWinTest:: |
+ ~StorageMonitorWindowWinTest() { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
} |
-void RemovableDeviceNotificationsWindowWinTest::SetUp() { |
+void StorageMonitorWindowWinTest::SetUp() { |
ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
volume_mount_watcher_ = new TestVolumeMountWatcherWin; |
- window_.reset(new TestRemovableDeviceNotificationsWindowWin( |
+ window_.reset(new TestStorageMonitorWindowWin( |
vandebo (ex-Chrome)
2013/03/01 19:47:39
this can be indented nicer now.
|
volume_mount_watcher_, new TestPortableDeviceWatcherWin)); |
window_->Init(); |
RunUntilIdle(); |
window_->AddObserver(&observer_); |
} |
-void RemovableDeviceNotificationsWindowWinTest::TearDown() { |
+void StorageMonitorWindowWinTest::TearDown() { |
RunUntilIdle(); |
window_->RemoveObserver(&observer_); |
} |
-void RemovableDeviceNotificationsWindowWinTest::PreAttachDevices() { |
+void StorageMonitorWindowWinTest::PreAttachDevices() { |
window_.reset(); |
volume_mount_watcher_ = new TestVolumeMountWatcherWin; |
volume_mount_watcher_->SetAttachedDevicesFake(); |
@@ -120,7 +120,7 @@ void RemovableDeviceNotificationsWindowWinTest::PreAttachDevices() { |
expect_attach_calls++; |
} |
- window_.reset(new TestRemovableDeviceNotificationsWindowWin( |
+ window_.reset(new TestStorageMonitorWindowWin( |
volume_mount_watcher_, new TestPortableDeviceWatcherWin)); |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: nicer indent possible.
|
window_->AddObserver(&observer_); |
window_->Init(); |
@@ -141,12 +141,12 @@ void RemovableDeviceNotificationsWindowWinTest::PreAttachDevices() { |
EXPECT_EQ(0, observer_.detach_calls()); |
} |
-void RemovableDeviceNotificationsWindowWinTest::RunUntilIdle() { |
+void StorageMonitorWindowWinTest::RunUntilIdle() { |
volume_mount_watcher_->FlushWorkerPoolForTesting(); |
message_loop_.RunUntilIdle(); |
} |
-void RemovableDeviceNotificationsWindowWinTest:: |
+void StorageMonitorWindowWinTest:: |
DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap
|
DEV_BROADCAST_VOLUME volume_broadcast; |
volume_broadcast.dbcv_size = sizeof(volume_broadcast); |
@@ -176,7 +176,7 @@ void RemovableDeviceNotificationsWindowWinTest:: |
EXPECT_EQ(0, observer_.detach_calls()); |
} |
-void RemovableDeviceNotificationsWindowWinTest:: |
+void StorageMonitorWindowWinTest:: |
DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
DEV_BROADCAST_VOLUME volume_broadcast; |
volume_broadcast.dbcv_size = sizeof(volume_broadcast); |
@@ -203,7 +203,7 @@ void RemovableDeviceNotificationsWindowWinTest:: |
EXPECT_EQ(expect_detach_calls, observer_.detach_calls()); |
} |
-void RemovableDeviceNotificationsWindowWinTest::DoMTPDeviceTest( |
+void StorageMonitorWindowWinTest::DoMTPDeviceTest( |
const string16& pnp_device_id, bool test_attach) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
GUID guidDevInterface = GUID_NULL; |
HRESULT hr = CLSIDFromString(kWPDDevInterfaceGUID, &guidDevInterface); |
@@ -249,7 +249,7 @@ void RemovableDeviceNotificationsWindowWinTest::DoMTPDeviceTest( |
EXPECT_EQ(expect_detach_calls, observer_.detach_calls()); |
} |
-bool RemovableDeviceNotificationsWindowWinTest::GetMTPStorageInfo( |
+bool StorageMonitorWindowWinTest::GetMTPStorageInfo( |
const std::string& storage_device_id, |
string16* pnp_device_id, |
string16* storage_object_id) { |
@@ -258,12 +258,12 @@ bool RemovableDeviceNotificationsWindowWinTest::GetMTPStorageInfo( |
storage_object_id); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, RandomMessage) { |
+TEST_F(StorageMonitorWindowWinTest, RandomMessage) { |
window_->InjectDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); |
RunUntilIdle(); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttached) { |
+TEST_F(StorageMonitorWindowWinTest, DevicesAttached) { |
DeviceIndices device_indices; |
device_indices.push_back(1); // B |
device_indices.push_back(5); // F |
@@ -298,21 +298,21 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttached) { |
EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info2.name); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedHighBoundary) { |
+TEST_F(StorageMonitorWindowWinTest, DevicesAttachedHighBoundary) { |
DeviceIndices device_indices; |
device_indices.push_back(25); |
DoMassStorageDeviceAttachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedLowBoundary) { |
+TEST_F(StorageMonitorWindowWinTest, DevicesAttachedLowBoundary) { |
DeviceIndices device_indices; |
device_indices.push_back(0); |
DoMassStorageDeviceAttachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedAdjacentBits) { |
+TEST_F(StorageMonitorWindowWinTest, DevicesAttachedAdjacentBits) { |
DeviceIndices device_indices; |
device_indices.push_back(0); |
device_indices.push_back(1); |
@@ -322,7 +322,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedAdjacentBits) { |
DoMassStorageDeviceAttachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesDetached) { |
+TEST_F(StorageMonitorWindowWinTest, DevicesDetached) { |
PreAttachDevices(); |
DeviceIndices device_indices; |
@@ -334,7 +334,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesDetached) { |
DoMassStorageDevicesDetachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, |
+TEST_F(StorageMonitorWindowWinTest, |
DevicesDetachedHighBoundary) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
PreAttachDevices(); |
@@ -344,7 +344,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, |
DoMassStorageDevicesDetachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, |
+TEST_F(StorageMonitorWindowWinTest, |
DevicesDetachedLowBoundary) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
PreAttachDevices(); |
@@ -354,7 +354,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, |
DoMassStorageDevicesDetachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, |
+TEST_F(StorageMonitorWindowWinTest, |
DevicesDetachedAdjacentBits) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
PreAttachDevices(); |
@@ -367,7 +367,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, |
DoMassStorageDevicesDetachedTest(device_indices); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, |
+TEST_F(StorageMonitorWindowWinTest, |
DuplicateAttachCheckSuppressed) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
volume_mount_watcher_->BlockDeviceCheckForTesting(); |
base::FilePath kAttachedDevicePath = |
@@ -417,7 +417,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, |
EXPECT_EQ(kAttachedDevicePath, checked_devices[1]); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DeviceInfoForPath) { |
+TEST_F(StorageMonitorWindowWinTest, DeviceInfoForPath) { |
PreAttachDevices(); |
// An invalid path. |
@@ -463,7 +463,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, DeviceInfoForPath) { |
} |
// Test to verify basic MTP storage attach and detach notifications. |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, MTPDeviceBasicAttachDetach) { |
+TEST_F(StorageMonitorWindowWinTest, MTPDeviceBasicAttachDetach) { |
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, true); |
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); |
} |
@@ -471,7 +471,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, MTPDeviceBasicAttachDetach) { |
// When a MTP storage device with invalid storage label and id is |
// attached/detached, there should not be any device attach/detach |
// notifications. |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, MTPDeviceWithInvalidInfo) { |
+TEST_F(StorageMonitorWindowWinTest, MTPDeviceWithInvalidInfo) { |
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithInvalidInfo, |
true); |
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithInvalidInfo, |
@@ -480,7 +480,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, MTPDeviceWithInvalidInfo) { |
// Attach a device with two data partitions. Verify that attach/detach |
// notifications are sent out for each removable storage. |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, |
+TEST_F(StorageMonitorWindowWinTest, |
MTPDeviceWithMultipleStorageObjects) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithMultipleStorages, |
true); |
@@ -488,7 +488,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, |
false); |
} |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, DriveNumberToFilePath) { |
+TEST_F(StorageMonitorWindowWinTest, DriveNumberToFilePath) { |
EXPECT_EQ(L"A:\\", VolumeMountWatcherWin::DriveNumberToFilePath(0).value()); |
EXPECT_EQ(L"Y:\\", VolumeMountWatcherWin::DriveNumberToFilePath(24).value()); |
EXPECT_EQ(L"", VolumeMountWatcherWin::DriveNumberToFilePath(-1).value()); |
@@ -497,7 +497,7 @@ TEST_F(RemovableDeviceNotificationsWindowWinTest, DriveNumberToFilePath) { |
// Given a MTP storage persistent id, GetMTPStorageInfo() should fetch the |
// device interface path and local storage object identifier. |
-TEST_F(RemovableDeviceNotificationsWindowWinTest, |
+TEST_F(StorageMonitorWindowWinTest, |
GetMTPStorageInfoFromDeviceId) { |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
|
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, true); |
PortableDeviceWatcherWin::StorageObjects storage_objects = |