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

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

Issue 16703025: [StorageMonitor] Move StorageMonitor ownership to BrowserProcessImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Catch up to SystemInfoStorage eject test Created 7 years, 5 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_unittest.cc
diff --git a/chrome/browser/storage_monitor/storage_monitor_unittest.cc b/chrome/browser/storage_monitor/storage_monitor_unittest.cc
index 9be3a508d434b5a9dd9191358a2efc086af559cf..46ac0a67a1cf1bb222a6ce92ea696f3f69b80410 100644
--- a/chrome/browser/storage_monitor/storage_monitor_unittest.cc
+++ b/chrome/browser/storage_monitor/storage_monitor_unittest.cc
@@ -10,22 +10,31 @@
#include "chrome/browser/storage_monitor/test_storage_monitor.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace {
+
+void SetLatch(bool* called) {
+ *called = true;
+}
+
+} // namespace
+
namespace chrome {
TEST(StorageMonitorTest, TestInitialize) {
+ test::TestStorageMonitor::RemoveSingleton();
test::TestStorageMonitor monitor;
EXPECT_FALSE(monitor.init_called_);
- base::WaitableEvent event(false, false);
- monitor.EnsureInitialized(base::Bind(&base::WaitableEvent::Signal,
- base::Unretained(&event)));
+ bool initialized = false;
+ monitor.EnsureInitialized(base::Bind(&SetLatch, &initialized));
EXPECT_TRUE(monitor.init_called_);
- EXPECT_FALSE(event.IsSignaled());
+ EXPECT_FALSE(initialized);
monitor.MarkInitialized();
- EXPECT_TRUE(event.IsSignaled());
+ EXPECT_TRUE(initialized);
}
TEST(StorageMonitorTest, DeviceAttachDetachNotifications) {
+ test::TestStorageMonitor::RemoveSingleton();
base::MessageLoop message_loop;
const string16 kDeviceName = ASCIIToUTF16("media device");
const std::string kDeviceId1 = "dcim:UUID:FFF0-0001";
@@ -73,6 +82,7 @@ TEST(StorageMonitorTest, DeviceAttachDetachNotifications) {
}
TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) {
+ test::TestStorageMonitor::RemoveSingleton();
base::MessageLoop message_loop;
test::TestStorageMonitor monitor;
std::vector<StorageInfo> devices = monitor.GetAllAvailableStorages();
@@ -80,6 +90,7 @@ TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) {
}
TEST(StorageMonitorTest, GetAllAvailableStorageAttachDetach) {
+ test::TestStorageMonitor::RemoveSingleton();
base::MessageLoop message_loop;
test::TestStorageMonitor monitor;
const std::string kDeviceId1 = "dcim:UUID:FFF0-0042";
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm ('k') | chrome/browser/storage_monitor/storage_monitor_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698