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

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

Issue 16703025: [StorageMonitor] Move StorageMonitor ownership to BrowserProcessImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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_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)
vandebo (ex-Chrome) 2013/07/10 16:57:45 Same here.
Greg Billock 2013/07/10 21:57:17 Done.
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698