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

Unified Diff: chrome/browser/system_monitor/removable_device_notifications_linux_unittest.cc

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make singleton pointer live in base class. Created 7 years, 11 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/system_monitor/removable_device_notifications_linux_unittest.cc
diff --git a/chrome/browser/system_monitor/removable_device_notifications_linux_unittest.cc b/chrome/browser/system_monitor/removable_device_notifications_linux_unittest.cc
index c0cacf6a939d2776de34674143952625d73a80a3..b9cb5930b871b923b594bea4e8d01ba94b7e9e96 100644
--- a/chrome/browser/system_monitor/removable_device_notifications_linux_unittest.cc
+++ b/chrome/browser/system_monitor/removable_device_notifications_linux_unittest.cc
@@ -16,13 +16,14 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
-#include "base/system_monitor/system_monitor.h"
-#include "base/test/mock_devices_changed_observer.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/system_monitor/media_device_notifications_utils.h"
#include "chrome/browser/system_monitor/media_storage_util.h"
+#include "chrome/browser/system_monitor/mock_removable_storage_observer.h"
#include "chrome/browser/system_monitor/removable_device_constants.h"
+#include "chrome/browser/system_monitor/removable_storage_notifications.h"
#include "content/public/test/test_browser_thread.h"
+#include "testing/gmock/include/gmock/gmock.h"
vandebo (ex-Chrome) 2013/01/18 18:42:58 Aren't you removing gmock use?
Greg Billock 2013/01/22 20:00:39 Done here and elsewhere. On 2013/01/18 18:42:58,
#include "testing/gtest/include/gtest/gtest.h"
namespace chrome {
@@ -185,10 +186,6 @@ class RemovableDeviceNotificationLinuxTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
- mock_devices_changed_observer_.reset(new base::MockDevicesChangedObserver);
- system_monitor_.AddDevicesChangedObserver(
- mock_devices_changed_observer_.get());
-
// Create and set up a temp dir with files for the test.
ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
FilePath test_dir = scoped_temp_dir_.path().AppendASCII("test_etc");
@@ -206,13 +203,15 @@ class RemovableDeviceNotificationLinuxTest : public testing::Test {
mtab_file_, &message_loop_);
notifications_->Init();
message_loop_.RunUntilIdle();
+
+ mock_storage_observer_.reset(new MockRemovableStorageObserver);
+ notifications_->AddObserver(mock_storage_observer_.get());
}
virtual void TearDown() OVERRIDE {
message_loop_.RunUntilIdle();
+ notifications_->RemoveObserver(mock_storage_observer_.get());
notifications_ = NULL;
- system_monitor_.RemoveDevicesChangedObserver(
- mock_devices_changed_observer_.get());
}
// Append mtab entries from the |data| array of size |data_size| to the mtab
@@ -256,8 +255,8 @@ class RemovableDeviceNotificationLinuxTest : public testing::Test {
file_util::Delete(dcim, false);
}
- base::MockDevicesChangedObserver& observer() {
- return *mock_devices_changed_observer_;
+ MockRemovableStorageObserver& observer() {
+ return *mock_storage_observer_;
}
RemovableDeviceNotificationsLinux* notifier() {
@@ -318,9 +317,7 @@ class RemovableDeviceNotificationLinuxTest : public testing::Test {
MessageLoop message_loop_;
content::TestBrowserThread file_thread_;
- // SystemMonitor and DevicesChangedObserver to hook together to test.
- base::SystemMonitor system_monitor_;
- scoped_ptr<base::MockDevicesChangedObserver> mock_devices_changed_observer_;
+ scoped_ptr<MockRemovableStorageObserver> mock_storage_observer_;
// Temporary directory for created test data.
base::ScopedTempDir scoped_temp_dir_;
@@ -343,37 +340,38 @@ TEST_F(RemovableDeviceNotificationLinuxTest, BasicAttachDetach) {
};
// Only |kDeviceDCIM2| should be attached, since |kDeviceFixed| has a bad
// path.
- EXPECT_CALL(observer(),
- OnRemovableStorageAttached(
- GetDeviceId(kDeviceDCIM2),
- GetDeviceNameWithSizeDetails(kDeviceDCIM2),
- test_path.value()))
- .InSequence(mock_sequence);
AppendToMtabAndRunLoop(test_data, arraysize(test_data));
+ EXPECT_EQ(1, observer().attach_calls());
+ EXPECT_EQ(GetDeviceId(kDeviceDCIM2), observer().last_attached().device_id);
+ EXPECT_EQ(GetDeviceNameWithSizeDetails(kDeviceDCIM2),
+ observer().last_attached().name);
+ EXPECT_EQ(test_path.value(),
+ observer().last_attached().location);
+
// |kDeviceDCIM2| should be detached here.
- EXPECT_CALL(observer(), OnRemovableStorageDetached(GetDeviceId(kDeviceDCIM2)))
- .InSequence(mock_sequence);
WriteEmptyMtabAndRunLoop();
+ EXPECT_EQ(1, observer().detach_calls());
+ EXPECT_EQ(GetDeviceId(kDeviceDCIM2), observer().last_detached().device_id);
}
// Only removable devices are recognized.
TEST_F(RemovableDeviceNotificationLinuxTest, Removable) {
- testing::Sequence mock_sequence;
FilePath test_path_a = CreateMountPointWithDCIMDir(kMountPointA);
ASSERT_FALSE(test_path_a.empty());
MtabTestData test_data1[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
};
// |kDeviceDCIM1| should be attached as expected.
- EXPECT_CALL(observer(),
- OnRemovableStorageAttached(
- GetDeviceId(kDeviceDCIM1),
- GetDeviceNameWithSizeDetails(kDeviceDCIM1),
- test_path_a.value()))
- .InSequence(mock_sequence);
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(1, observer().attach_calls());
+ EXPECT_EQ(GetDeviceId(kDeviceDCIM1), observer().last_attached().device_id);
+ EXPECT_EQ(GetDeviceNameWithSizeDetails(kDeviceDCIM1),
+ observer().last_attached().name);
+ EXPECT_EQ(test_path_a.value(),
+ observer().last_attached().location);
+
// This should do nothing, since |kDeviceFixed| is not removable.
FilePath test_path_b = CreateMountPointWithoutDCIMDir(kMountPointB);
ASSERT_FALSE(test_path_b.empty());
@@ -381,29 +379,29 @@ TEST_F(RemovableDeviceNotificationLinuxTest, Removable) {
MtabTestData(kDeviceFixed, test_path_b.value(), kValidFS),
};
AppendToMtabAndRunLoop(test_data2, arraysize(test_data2));
+ EXPECT_EQ(1, observer().attach_calls());
// |kDeviceDCIM1| should be detached as expected.
- EXPECT_CALL(observer(), OnRemovableStorageDetached(GetDeviceId(kDeviceDCIM1)))
- .InSequence(mock_sequence);
WriteEmptyMtabAndRunLoop();
+ EXPECT_EQ(1, observer().detach_calls());
+ EXPECT_EQ(GetDeviceId(kDeviceDCIM1), observer().last_detached().device_id);
// |kDeviceNoDCIM| should be attached as expected.
- EXPECT_CALL(observer(),
- OnRemovableStorageAttached(
- GetDeviceId(kDeviceNoDCIM),
- GetDeviceNameWithSizeDetails(kDeviceNoDCIM),
- test_path_b.value()))
- .InSequence(mock_sequence);
MtabTestData test_data3[] = {
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
};
AppendToMtabAndRunLoop(test_data3, arraysize(test_data3));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(GetDeviceId(kDeviceNoDCIM), observer().last_attached().device_id);
+ EXPECT_EQ(GetDeviceNameWithSizeDetails(kDeviceNoDCIM),
+ observer().last_attached().name);
+ EXPECT_EQ(test_path_b.value(),
+ observer().last_attached().location);
// |kDeviceNoDCIM| should be detached as expected.
- EXPECT_CALL(observer(),
- OnRemovableStorageDetached(GetDeviceId(kDeviceNoDCIM)))
- .InSequence(mock_sequence);
WriteEmptyMtabAndRunLoop();
+ EXPECT_EQ(2, observer().detach_calls());
+ EXPECT_EQ(GetDeviceId(kDeviceNoDCIM), observer().last_detached().device_id);
}
// More complicated test case with multiple devices on multiple mount points.
@@ -413,16 +411,17 @@ TEST_F(RemovableDeviceNotificationLinuxTest, SwapMountPoints) {
ASSERT_FALSE(test_path_a.empty());
ASSERT_FALSE(test_path_b.empty());
- // Attach two devices. (*'d mounts are those SystemMonitor knows about.)
+ // Attach two devices.
+ // (*'d mounts are those RemovableStorageNotifications knows about.)
// kDeviceDCIM1 -> kMountPointA *
// kDeviceDCIM2 -> kMountPointB *
MtabTestData test_data1[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
MtabTestData(kDeviceDCIM2, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(0, observer().detach_calls());
// Detach two devices from old mount points and attach the devices at new
// mount points.
@@ -432,14 +431,14 @@ TEST_F(RemovableDeviceNotificationLinuxTest, SwapMountPoints) {
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
MtabTestData(kDeviceDCIM2, test_path_a.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(2);
OverwriteMtabAndRunLoop(test_data2, arraysize(test_data2));
+ EXPECT_EQ(4, observer().attach_calls());
+ EXPECT_EQ(2, observer().detach_calls());
// Detach all devices.
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(2);
WriteEmptyMtabAndRunLoop();
+ EXPECT_EQ(4, observer().attach_calls());
+ EXPECT_EQ(4, observer().detach_calls());
}
// More complicated test case with multiple devices on multiple mount points.
@@ -449,16 +448,17 @@ TEST_F(RemovableDeviceNotificationLinuxTest, MultiDevicesMultiMountPoints) {
ASSERT_FALSE(test_path_a.empty());
ASSERT_FALSE(test_path_b.empty());
- // Attach two devices. (*'d mounts are those SystemMonitor knows about.)
+ // Attach two devices.
+ // (*'d mounts are those RemovableStorageNotifications knows about.)
// kDeviceDCIM1 -> kMountPointA *
// kDeviceDCIM2 -> kMountPointB *
MtabTestData test_data1[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
MtabTestData(kDeviceDCIM2, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(0, observer().detach_calls());
// Attach |kDeviceDCIM1| to |kMountPointB|.
// |kDeviceDCIM2| is inaccessible, so it is detached. |kDeviceDCIM1| has been
@@ -469,9 +469,9 @@ TEST_F(RemovableDeviceNotificationLinuxTest, MultiDevicesMultiMountPoints) {
MtabTestData test_data2[] = {
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
AppendToMtabAndRunLoop(test_data2, arraysize(test_data2));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(1, observer().detach_calls());
// Detach |kDeviceDCIM1| from |kMountPointA|, causing a detach and attach
// event.
@@ -481,9 +481,9 @@ TEST_F(RemovableDeviceNotificationLinuxTest, MultiDevicesMultiMountPoints) {
MtabTestData(kDeviceDCIM2, test_path_b.value(), kValidFS),
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(1);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
OverwriteMtabAndRunLoop(test_data3, arraysize(test_data3));
+ EXPECT_EQ(3, observer().attach_calls());
+ EXPECT_EQ(2, observer().detach_calls());
// Attach |kDeviceDCIM1| to |kMountPointA|.
// kDeviceDCIM2 -> kMountPointB
@@ -492,21 +492,21 @@ TEST_F(RemovableDeviceNotificationLinuxTest, MultiDevicesMultiMountPoints) {
MtabTestData test_data4[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data4, arraysize(test_data4));
+ EXPECT_EQ(3, observer().attach_calls());
+ EXPECT_EQ(2, observer().detach_calls());
// Detach |kDeviceDCIM1| from |kMountPointB|.
// kDeviceDCIM1 -> kMountPointA *
// kDeviceDCIM2 -> kMountPointB *
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
OverwriteMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(5, observer().attach_calls());
+ EXPECT_EQ(3, observer().detach_calls());
// Detach all devices.
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(2);
WriteEmptyMtabAndRunLoop();
+ EXPECT_EQ(5, observer().attach_calls());
+ EXPECT_EQ(5, observer().detach_calls());
}
TEST_F(RemovableDeviceNotificationLinuxTest,
@@ -516,14 +516,15 @@ TEST_F(RemovableDeviceNotificationLinuxTest,
ASSERT_FALSE(test_path_a.empty());
ASSERT_FALSE(test_path_b.empty());
- // Attach to one first. (*'d mounts are those SystemMonitor knows about.)
+ // Attach to one first.
+ // (*'d mounts are those RemovableStorageNotifications knows about.)
// kDeviceDCIM1 -> kMountPointA *
MtabTestData test_data1[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(1);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(1, observer().attach_calls());
+ EXPECT_EQ(0, observer().detach_calls());
// Attach |kDeviceDCIM1| to |kMountPointB|.
// kDeviceDCIM1 -> kMountPointA *
@@ -531,9 +532,9 @@ TEST_F(RemovableDeviceNotificationLinuxTest,
MtabTestData test_data2[] = {
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data2, arraysize(test_data2));
+ EXPECT_EQ(1, observer().attach_calls());
+ EXPECT_EQ(0, observer().detach_calls());
// Attach |kDeviceFixed| (a non-removable device) to |kMountPointA|.
// kDeviceDCIM1 -> kMountPointA
@@ -542,10 +543,10 @@ TEST_F(RemovableDeviceNotificationLinuxTest,
MtabTestData test_data3[] = {
MtabTestData(kDeviceFixed, test_path_a.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(1);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
RemoveDCIMDirFromMountPoint(kMountPointA);
AppendToMtabAndRunLoop(test_data3, arraysize(test_data3));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(1, observer().detach_calls());
// Detach |kDeviceFixed|.
// kDeviceDCIM1 -> kMountPointA
@@ -554,10 +555,10 @@ TEST_F(RemovableDeviceNotificationLinuxTest,
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
CreateMountPointWithDCIMDir(kMountPointA);
OverwriteMtabAndRunLoop(test_data4, arraysize(test_data4));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(1, observer().detach_calls());
// Attach |kDeviceNoDCIM| (a non-DCIM device) to |kMountPointB|.
// kDeviceDCIM1 -> kMountPointA *
@@ -566,10 +567,10 @@ TEST_F(RemovableDeviceNotificationLinuxTest,
MtabTestData test_data5[] = {
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
file_util::Delete(test_path_b.Append(kDCIMDirectoryName), false);
AppendToMtabAndRunLoop(test_data5, arraysize(test_data5));
+ EXPECT_EQ(4, observer().attach_calls());
+ EXPECT_EQ(2, observer().detach_calls());
// Detach |kDeviceNoDCIM|.
// kDeviceDCIM1 -> kMountPointA *
@@ -578,21 +579,21 @@ TEST_F(RemovableDeviceNotificationLinuxTest,
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
CreateMountPointWithDCIMDir(kMountPointB);
OverwriteMtabAndRunLoop(test_data6, arraysize(test_data6));
+ EXPECT_EQ(4, observer().attach_calls());
+ EXPECT_EQ(3, observer().detach_calls());
// Detach |kDeviceDCIM1| from |kMountPointB|.
// kDeviceDCIM1 -> kMountPointA *
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
OverwriteMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(4, observer().attach_calls());
+ EXPECT_EQ(3, observer().detach_calls());
// Detach all devices.
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
WriteEmptyMtabAndRunLoop();
+ EXPECT_EQ(4, observer().attach_calls());
+ EXPECT_EQ(4, observer().detach_calls());
}
TEST_F(RemovableDeviceNotificationLinuxTest, DeviceLookUp) {
@@ -603,7 +604,8 @@ TEST_F(RemovableDeviceNotificationLinuxTest, DeviceLookUp) {
ASSERT_FALSE(test_path_b.empty());
ASSERT_FALSE(test_path_c.empty());
- // Attach to one first. (*'d mounts are those SystemMonitor knows about.)
+ // Attach to one first.
+ // (*'d mounts are those RemovableStorageNotifications knows about.)
// kDeviceDCIM1 -> kMountPointA *
// kDeviceNoDCIM -> kMountPointB *
// kDeviceFixed -> kMountPointC
@@ -612,11 +614,11 @@ TEST_F(RemovableDeviceNotificationLinuxTest, DeviceLookUp) {
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
MtabTestData(kDeviceFixed, test_path_c.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(0, observer().detach_calls());
- base::SystemMonitor::RemovableStorageInfo device_info;
+ RemovableStorageNotifications::StorageInfo device_info;
EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_a, &device_info));
EXPECT_EQ(GetDeviceId(kDeviceDCIM1), device_info.device_id);
EXPECT_EQ(test_path_a.value(), device_info.location);
@@ -651,8 +653,6 @@ TEST_F(RemovableDeviceNotificationLinuxTest, DeviceLookUp) {
MtabTestData(kDeviceFixed, test_path_b.value(), kValidFS),
MtabTestData(kDeviceFixed, test_path_c.value(), kValidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(1);
AppendToMtabAndRunLoop(test_data2, arraysize(test_data2));
EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_a, &device_info));
@@ -663,6 +663,9 @@ TEST_F(RemovableDeviceNotificationLinuxTest, DeviceLookUp) {
EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_c, &device_info));
EXPECT_EQ(GetDeviceId(kDeviceFixed), device_info.device_id);
+
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(1, observer().detach_calls());
}
TEST_F(RemovableDeviceNotificationLinuxTest, DevicePartitionSize) {
@@ -676,9 +679,9 @@ TEST_F(RemovableDeviceNotificationLinuxTest, DevicePartitionSize) {
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
MtabTestData(kDeviceFixed, kInvalidPath, kInvalidFS),
};
- EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(2);
- EXPECT_CALL(observer(), OnRemovableStorageDetached(_)).Times(0);
AppendToMtabAndRunLoop(test_data1, arraysize(test_data1));
+ EXPECT_EQ(2, observer().attach_calls());
+ EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(GetDevicePartitionSize(kDeviceDCIM1),
notifier()->GetStorageSize(test_path_a.value()));

Powered by Google App Engine
This is Rietveld 408576698