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

Unified Diff: chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm

Issue 12382005: Rename RemovableDeviceNotifications=>StorageMonitor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 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
Index: chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
diff --git a/chrome/browser/storage_monitor/removable_device_notifications_mac_unittest.mm b/chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
similarity index 79%
rename from chrome/browser/storage_monitor/removable_device_notifications_mac_unittest.mm
rename to chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
index d5fd0388669da4e6fd2105a28a3fda5dfc0e040b..3a851e77e701cd6034c63e4cf834066dd3166eeb 100644
--- a/chrome/browser/storage_monitor/removable_device_notifications_mac_unittest.mm
+++ b/chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/storage_monitor/removable_device_notifications_mac.h"
+#include "chrome/browser/storage_monitor/storage_monitor_mac.h"
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -50,19 +50,18 @@ DiskInfoMac CreateDiskInfoMac(const std::string& unique_id,
} // namespace
-class RemovableDeviceNotificationsMacTest : public testing::Test {
+class StorageMonitorMacTest : public testing::Test {
public:
- RemovableDeviceNotificationsMacTest()
+ StorageMonitorMacTest()
: message_loop_(MessageLoop::TYPE_IO),
file_thread_(content::BrowserThread::FILE, &message_loop_) {
}
virtual void SetUp() OVERRIDE {
- notifications_ = new RemovableDeviceNotificationsMac;
+ monitor_ = new StorageMonitorMac;
mock_storage_observer_.reset(new MockRemovableStorageObserver);
- notifications_->AddObserver(mock_storage_observer_.get());
-
+ monitor_->AddObserver(mock_storage_observer_.get());
unique_id_ = "test_id";
display_name_ = ASCIIToUTF16("977 KB Test Display Name");
@@ -88,12 +87,11 @@ class RemovableDeviceNotificationsMacTest : public testing::Test {
std::string device_id_;
DiskInfoMac disk_info_;
- scoped_refptr<RemovableDeviceNotificationsMac> notifications_;
+ scoped_refptr<StorageMonitorMac> monitor_;
};
-TEST_F(RemovableDeviceNotificationsMacTest, AddRemove) {
- notifications_->UpdateDisk(
- disk_info_, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED);
+TEST_F(StorageMonitorMacTest, AddRemove) {
+ monitor_->UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_ADDED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->attach_calls());
EXPECT_EQ(0, mock_storage_observer_->detach_calls());
@@ -102,17 +100,15 @@ TEST_F(RemovableDeviceNotificationsMacTest, AddRemove) {
EXPECT_EQ(mount_point_.value(),
mock_storage_observer_->last_attached().location);
- notifications_->UpdateDisk(
- disk_info_, RemovableDeviceNotificationsMac::UPDATE_DEVICE_REMOVED);
+ monitor_->UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_REMOVED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->attach_calls());
EXPECT_EQ(1, mock_storage_observer_->detach_calls());
EXPECT_EQ(device_id_, mock_storage_observer_->last_detached().device_id);
}
-TEST_F(RemovableDeviceNotificationsMacTest, UpdateVolumeName) {
- notifications_->UpdateDisk(
- disk_info_, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED);
+TEST_F(StorageMonitorMacTest, UpdateVolumeName) {
+ monitor_->UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_ADDED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->attach_calls());
@@ -126,8 +122,7 @@ TEST_F(RemovableDeviceNotificationsMacTest, UpdateVolumeName) {
DiskInfoMac info2 = CreateDiskInfoMac(
unique_id_, "", ASCIIToUTF16("Test Display Name"), mount_point_,
kTestSize);
- notifications_->UpdateDisk(
- info2, RemovableDeviceNotificationsMac::UPDATE_DEVICE_CHANGED);
+ monitor_->UpdateDisk(info2, StorageMonitorMac::UPDATE_DEVICE_CHANGED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->detach_calls());
@@ -139,7 +134,7 @@ TEST_F(RemovableDeviceNotificationsMacTest, UpdateVolumeName) {
mock_storage_observer_->last_attached().location);
}
-TEST_F(RemovableDeviceNotificationsMacTest, DCIM) {
+TEST_F(StorageMonitorMacTest, DCIM) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
ASSERT_TRUE(file_util::CreateDirectory(
@@ -152,8 +147,7 @@ TEST_F(RemovableDeviceNotificationsMacTest, DCIM) {
std::string device_id = MediaStorageUtil::MakeDeviceId(
MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_);
- notifications_->UpdateDisk(
- info, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED);
+ monitor_->UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->attach_calls());
@@ -164,9 +158,8 @@ TEST_F(RemovableDeviceNotificationsMacTest, DCIM) {
mock_storage_observer_->last_attached().location);
}
-TEST_F(RemovableDeviceNotificationsMacTest, GetStorageInfo) {
- notifications_->UpdateDisk(
- disk_info_, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED);
+TEST_F(StorageMonitorMacTest, GetStorageInfo) {
+ monitor_->UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_ADDED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->attach_calls());
@@ -177,32 +170,30 @@ TEST_F(RemovableDeviceNotificationsMacTest, GetStorageInfo) {
mock_storage_observer_->last_attached().location);
StorageMonitor::StorageInfo info;
- EXPECT_TRUE(notifications_->GetStorageInfoForPath(
- mount_point_.AppendASCII("foo"), &info));
+ EXPECT_TRUE(monitor_->GetStorageInfoForPath(mount_point_.AppendASCII("foo"),
+ &info));
EXPECT_EQ(info.device_id, device_id_);
EXPECT_EQ(info.name, ASCIIToUTF16("Test Display Name"));
EXPECT_EQ(info.location, mount_point_.value());
- EXPECT_FALSE(notifications_->GetStorageInfoForPath(
+ EXPECT_FALSE(monitor_->GetStorageInfoForPath(
base::FilePath("/non/matching/path"), &info));
}
-TEST_F(RemovableDeviceNotificationsMacTest, GetStorageSize) {
- notifications_->UpdateDisk(
- disk_info_, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED);
+TEST_F(StorageMonitorMacTest, GetStorageSize) {
+ monitor_->UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_ADDED);
message_loop_.RunUntilIdle();
EXPECT_EQ(1, mock_storage_observer_->attach_calls());
EXPECT_EQ(kTestSize,
- notifications_->GetStorageSize("/unused_test_directory"));
+ monitor_->GetStorageSize("/unused_test_directory"));
}
// Test that mounting a DMG doesn't send a notification.
-TEST_F(RemovableDeviceNotificationsMacTest, DMG) {
+TEST_F(StorageMonitorMacTest, DMG) {
DiskInfoMac info = CreateDiskInfoMac(
unique_id_, "Disk Image", display_name_, mount_point_, kTestSize);
- notifications_->UpdateDisk(
- info, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED);
+ monitor_->UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED);
message_loop_.RunUntilIdle();
EXPECT_EQ(0, mock_storage_observer_->attach_calls());
}
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor_mac.mm ('k') | chrome/browser/storage_monitor/storage_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698