summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc23
-rw-r--r--chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc27
-rw-r--r--chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc12
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover_unittest.cc22
-rw-r--r--chrome/browser/browsing_data/cookies_tree_model_unittest.cc18
5 files changed, 22 insertions, 80 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
index a54b9bd..968a733a 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
@@ -4,12 +4,11 @@
#include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
-
#include "base/bind.h"
#include "base/message_loop.h"
-#include "base/synchronization/waitable_event.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/parsed_cookie.h"
#include "net/url_request/url_request_context_getter.h"
@@ -21,7 +20,7 @@ namespace {
class BrowsingDataCookieHelperTest : public testing::Test {
public:
- void SetUpOnIOThread(base::WaitableEvent* io_setup_complete) {
+ void SetUpOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// This is a workaround for a bug in the TestingProfile.
// The URLRequestContext will be created by GetCookieMonster on the UI
@@ -30,31 +29,21 @@ class BrowsingDataCookieHelperTest : public testing::Test {
// Force it to be created here.
testing_profile_->CreateRequestContext();
testing_profile_->GetRequestContext()->GetURLRequestContext();
- io_setup_complete->Signal();
}
virtual void SetUp() {
- ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI,
- &message_loop_));
- // Note: we're starting a real IO thread because parts of the
- // BrowsingDataCookieHelper expect to run on that thread.
- io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO));
- ASSERT_TRUE(io_thread_->Start());
testing_profile_.reset(new TestingProfile());
- base::WaitableEvent io_setup_complete(true, false);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&BrowsingDataCookieHelperTest::SetUpOnIOThread,
- base::Unretained(this), &io_setup_complete));
- io_setup_complete.Wait();
+ base::Unretained(this)));
+ base::MessageLoop::current()->RunUntilIdle();
}
virtual void TearDown() {
// This must be reset before the IO thread stops, because the
// URLRequestContextGetter forces its own deletion to occur on that thread.
testing_profile_->ResetRequestContext();
- io_thread_.reset();
- ui_thread_.reset();
}
void CreateCookiesForTest() {
@@ -209,9 +198,7 @@ class BrowsingDataCookieHelperTest : public testing::Test {
}
protected:
- base::MessageLoop message_loop_;
- scoped_ptr<content::TestBrowserThread> ui_thread_;
- scoped_ptr<content::TestBrowserThread> io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> testing_profile_;
net::CookieList cookie_list_;
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
index ad756e4..0bc6b11 100644
--- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "webkit/browser/fileapi/file_system_context.h"
#include "webkit/browser/fileapi/file_system_url.h"
#include "webkit/browser/fileapi/file_system_usage_cache.h"
@@ -62,26 +63,19 @@ typedef scoped_ptr<FileSystemInfoList> ScopedFileSystemInfoList;
// point.
class BrowsingDataFileSystemHelperTest : public testing::Test {
public:
- BrowsingDataFileSystemHelperTest()
- : 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_) {
+ BrowsingDataFileSystemHelperTest() {
profile_.reset(new TestingProfile());
helper_ = BrowsingDataFileSystemHelper::Create(
BrowserContext::GetDefaultStoragePartition(profile_.get())->
GetFileSystemContext());
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
canned_helper_ = new CannedBrowsingDataFileSystemHelper(profile_.get());
}
virtual ~BrowsingDataFileSystemHelperTest() {
// Avoid memory leaks.
profile_.reset();
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
TestingProfile* GetProfile() {
@@ -153,7 +147,7 @@ class BrowsingDataFileSystemHelperTest : public testing::Test {
// Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent
// file system, and kOrigin3 with both.
- virtual void PopulateTestFileSystemData() {
+ void PopulateTestFileSystemData() {
sandbox_ = BrowserContext::GetDefaultStoragePartition(profile_.get())->
GetFileSystemContext()->sandbox_provider();
@@ -186,16 +180,7 @@ class BrowsingDataFileSystemHelperTest : public testing::Test {
}
protected:
- // message_loop_, as well as all the threads associated with it must be
- // defined before profile_ to prevent explosions. The threads also must be
- // defined in the order they're listed here. Oh how I love C++.
- base::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_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
// Temporary storage to pass information back from callbacks.
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
index ce0b511..095c631 100644
--- a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
@@ -8,10 +8,10 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
-#include "base/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "chrome/browser/browsing_data/browsing_data_quota_helper_impl.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "webkit/browser/quota/mock_storage_client.h"
#include "webkit/browser/quota/quota_manager.h"
@@ -23,10 +23,7 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
typedef BrowsingDataQuotaHelper::QuotaInfoArray QuotaInfoArray;
BrowsingDataQuotaHelperTest()
- : ui_thread_(BrowserThread::UI, &message_loop_),
- db_thread_(BrowserThread::DB, &message_loop_),
- io_thread_(BrowserThread::IO, &message_loop_),
- fetching_completed_(true),
+ : fetching_completed_(true),
quota_(-1),
weak_factory_(this) {}
@@ -114,10 +111,7 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
fetching_completed_ = true;
}
- base::MessageLoop message_loop_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread db_thread_;
- content::TestBrowserThread io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_refptr<quota::QuotaManager> quota_manager_;
base::ScopedTempDir dir_;
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 11021fc..a996a1e 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -35,6 +35,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "net/cookies/cookie_monster.h"
#include "net/ssl/server_bound_cert_service.h"
#include "net/ssl/server_bound_cert_store.h"
@@ -542,14 +543,7 @@ class BrowsingDataRemoverTest : public testing::Test,
public content::NotificationObserver {
public:
BrowsingDataRemoverTest()
- : 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_(new TestingProfile()) {
+ : profile_(new TestingProfile()) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
content::Source<Profile>(profile_.get()));
}
@@ -564,7 +558,7 @@ class BrowsingDataRemoverTest : public testing::Test,
// the message loop is cleared out, before destroying the threads and loop.
// Otherwise we leak memory.
profile_.reset();
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
void BlockUntilBrowsingDataRemoved(BrowsingDataRemover::TimePeriod period,
@@ -652,15 +646,7 @@ class BrowsingDataRemoverTest : public testing::Test,
scoped_ptr<BrowsingDataRemover::NotificationDetails> called_with_details_;
content::NotificationRegistrar registrar_;
- // message_loop_, as well as all the threads associated with it must be
- // defined before profile_ to prevent explosions. Oh how I love C++.
- base::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_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
scoped_refptr<quota::MockQuotaManager> quota_manager_;
diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
index 07fd27b..531b540 100644
--- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
+++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
@@ -24,7 +24,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -38,17 +38,11 @@ namespace {
class CookiesTreeModelTest : public testing::Test {
public:
- CookiesTreeModelTest()
- : ui_thread_(BrowserThread::UI, &message_loop_),
- file_user_blocking_(BrowserThread::FILE_USER_BLOCKING, &message_loop_),
- io_thread_(BrowserThread::IO, &message_loop_) {
- }
-
virtual ~CookiesTreeModelTest() {
// Avoid memory leaks.
special_storage_policy_ = NULL;
profile_.reset();
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
virtual void SetUp() OVERRIDE {
@@ -92,7 +86,7 @@ class CookiesTreeModelTest : public testing::Test {
mock_browsing_data_local_storage_helper_ = NULL;
mock_browsing_data_database_helper_ = NULL;
mock_browsing_data_flash_lso_helper_ = NULL;
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() {
@@ -339,11 +333,7 @@ class CookiesTreeModelTest : public testing::Test {
}
protected:
- base::MessageLoop message_loop_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread file_user_blocking_;
- content::TestBrowserThread io_thread_;
-
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
scoped_refptr<MockBrowsingDataCookieHelper>
mock_browsing_data_cookie_helper_;