| Index: chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
|
| diff --git a/chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm b/chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
|
| index d339f308cb4d1b291a28295fe6604aff286ddbff..0801637e7a0ab4c1868983f8fb1c68b1a7440142 100644
|
| --- a/chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
|
| +++ b/chrome/browser/storage_monitor/storage_monitor_mac_unittest.mm
|
| @@ -14,6 +14,8 @@
|
| #include "chrome/browser/storage_monitor/mock_removable_storage_observer.h"
|
| #include "chrome/browser/storage_monitor/removable_device_constants.h"
|
| #include "chrome/browser/storage_monitor/storage_info.h"
|
| +#include "chrome/browser/storage_monitor/test_storage_monitor.h"
|
| +#include "chrome/test/base/testing_browser_process.h"
|
| #include "content/public/test/test_browser_thread.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -44,7 +46,11 @@ class StorageMonitorMacTest : public testing::Test {
|
| }
|
|
|
| virtual void SetUp() OVERRIDE {
|
| - monitor_.reset(new StorageMonitorMac);
|
| + test::TestStorageMonitor::RemoveSingleton();
|
| + monitor_ = new StorageMonitorMac;
|
| + TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal();
|
| + if (browser_process)
|
| + browser_process->SetStorageMonitor(monitor_);
|
|
|
| mock_storage_observer_.reset(new MockRemovableStorageObserver);
|
| monitor_->AddObserver(mock_storage_observer_.get());
|
| @@ -60,7 +66,7 @@ class StorageMonitorMacTest : public testing::Test {
|
| void UpdateDisk(StorageInfo info, StorageMonitorMac::UpdateType update_type) {
|
| content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
| base::Bind(&StorageMonitorMac::UpdateDisk,
|
| - base::Unretained(monitor_.get()),
|
| + base::Unretained(monitor_),
|
| "dummy_bsd_name", info, update_type));
|
| base::RunLoop().RunUntilIdle();
|
| }
|
| @@ -79,7 +85,8 @@ class StorageMonitorMacTest : public testing::Test {
|
| std::string device_id_;
|
| StorageInfo disk_info_;
|
|
|
| - scoped_ptr<StorageMonitorMac> monitor_;
|
| + // Pointer to the storage monitor. Owned by TestingBrowserProcess.
|
| + StorageMonitorMac* monitor_;
|
| };
|
|
|
| TEST_F(StorageMonitorMacTest, AddRemove) {
|
|
|