| Index: chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
|
| diff --git a/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc b/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
|
| index a8c82a52dc624eb5ca5e6951cc492e20b79eec9d..a770ffc86dde6ea1a4c73e4f5695fbd7d35d55b1 100644
|
| --- a/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
|
| +++ b/chrome/browser/storage_monitor/storage_monitor_linux_unittest.cc
|
| @@ -23,6 +23,8 @@
|
| #include "chrome/browser/storage_monitor/storage_info.h"
|
| #include "chrome/browser/storage_monitor/storage_monitor.h"
|
| #include "chrome/browser/storage_monitor/test_media_transfer_protocol_manager_linux.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"
|
|
|
| @@ -181,8 +183,12 @@ class StorageMonitorLinuxTest : public testing::Test {
|
| arraysize(initial_test_data),
|
| true /* overwrite */);
|
|
|
| - // Initialize the test subject.
|
| - monitor_.reset(new TestStorageMonitorLinux(mtab_file_, &message_loop_));
|
| + test::TestStorageMonitor::RemoveSingleton();
|
| + monitor_ = new TestStorageMonitorLinux(mtab_file_, &message_loop_);
|
| + TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal();
|
| + if (browser_process)
|
| + browser_process->SetStorageMonitor(monitor_);
|
| +
|
| mock_storage_observer_.reset(new MockRemovableStorageObserver);
|
| monitor_->AddObserver(mock_storage_observer_.get());
|
|
|
| @@ -193,8 +199,10 @@ class StorageMonitorLinuxTest : public testing::Test {
|
| virtual void TearDown() OVERRIDE {
|
| base::RunLoop().RunUntilIdle();
|
| monitor_->RemoveObserver(mock_storage_observer_.get());
|
| - monitor_.reset();
|
| base::RunLoop().RunUntilIdle();
|
| +
|
| + // Linux storage monitor must be destroyed on the UI thread, so do it here.
|
| + test::TestStorageMonitor::RemoveSingleton();
|
| }
|
|
|
| // Append mtab entries from the |data| array of size |data_size| to the mtab
|
| @@ -243,7 +251,7 @@ class StorageMonitorLinuxTest : public testing::Test {
|
| }
|
|
|
| StorageMonitor* notifier() {
|
| - return monitor_.get();
|
| + return monitor_;
|
| }
|
|
|
| uint64 GetStorageSize(const base::FilePath& path) {
|
| @@ -316,7 +324,8 @@ class StorageMonitorLinuxTest : public testing::Test {
|
| // Path to the test mtab file.
|
| base::FilePath mtab_file_;
|
|
|
| - scoped_ptr<TestStorageMonitorLinux> monitor_;
|
| + // Pointer to the storage monitor. Owned by TestingBrowserProcess.
|
| + TestStorageMonitorLinux* monitor_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinuxTest);
|
| };
|
|
|