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

Unified Diff: chrome/browser/browsing_data_file_system_helper_unittest.cc

Issue 9419033: Move creation of BrowserContext objects that live in content to content, instead of depending on th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix memory leaks in tests Created 8 years, 10 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/browsing_data_file_system_helper_unittest.cc
===================================================================
--- chrome/browser/browsing_data_file_system_helper_unittest.cc (revision 122721)
+++ chrome/browser/browsing_data_file_system_helper_unittest.cc (working copy)
@@ -18,6 +18,7 @@
#include "webkit/fileapi/file_system_usage_cache.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
+using content::BrowserContext;
using content::BrowserThread;
namespace {
@@ -54,16 +55,25 @@
class BrowsingDataFileSystemHelperTest : public testing::Test {
public:
BrowsingDataFileSystemHelperTest()
- : helper_(BrowsingDataFileSystemHelper::Create(&profile_)),
- canned_helper_(new CannedBrowsingDataFileSystemHelper(&profile_)),
- ui_thread_(BrowserThread::UI, &message_loop_),
+ : ui_thread_(BrowserThread::UI, &message_loop_),
+ db_thread_(BrowserThread::DB, &message_loop_),
+ webkit_thread_(BrowserThread::WEBKIT_DEPRECATED, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, &message_loop_),
io_thread_(BrowserThread::IO, &message_loop_) {
+ profile_.reset(new TestingProfile());
+ helper_ = BrowsingDataFileSystemHelper::Create(profile_.get());
+ canned_helper_ = new CannedBrowsingDataFileSystemHelper(profile_.get());
}
- virtual ~BrowsingDataFileSystemHelperTest() {}
+ virtual ~BrowsingDataFileSystemHelperTest() {
+ // Avoid memory leaks.
+ profile_.reset();
+ message_loop_.RunAllPending();
+ }
TestingProfile* GetProfile() {
- return &profile_;
+ return profile_.get();
}
// Blocks on the current MessageLoop until Notify() is called.
@@ -131,7 +141,8 @@
// Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent
// file system, and kOrigin3 with both.
virtual void PopulateTestFileSystemData() {
- sandbox_ = profile_.GetFileSystemContext()->sandbox_provider();
+ sandbox_ = BrowserContext::GetFileSystemContext(profile_.get())->
+ sandbox_provider();
CreateDirectoryForOriginAndType(kOrigin1, kTemporary);
CreateDirectoryForOriginAndType(kOrigin2, kPersistent);
@@ -175,9 +186,12 @@
// defined in the order they're listed here. Oh how I love C++.
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread db_thread_;
+ content::TestBrowserThread webkit_thread_;
content::TestBrowserThread file_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
- TestingProfile profile_;
+ scoped_ptr<TestingProfile> profile_;
// We don't own this pointer: don't delete it.
fileapi::SandboxMountPointProvider* sandbox_;
« no previous file with comments | « chrome/browser/browsing_data_file_system_helper.cc ('k') | chrome/browser/browsing_data_indexed_db_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698