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

Unified Diff: chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fixes. Created 7 years, 6 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/chromeos/drive/drive_file_stream_reader_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc b/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc
index f266d2122df46185bf920149748725f5a6ee7466..a703ef343130355d71795c4fa843605b3a1e706a 100644
--- a/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/google_apis/fake_drive_service.h"
#include "chrome/browser/google_apis/task_util.h"
#include "chrome/browser/google_apis/test_util.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -43,7 +43,7 @@ void IncrementCallback(int* num_called) {
class LocalReaderProxyTest : public ::testing::Test {
protected:
- LocalReaderProxyTest() : io_thread_(BrowserThread::IO, &message_loop_) {
+ LocalReaderProxyTest() : thread_bundle_(IO_MAINLOOP) {
}
virtual void SetUp() OVERRIDE {
@@ -59,8 +59,7 @@ class LocalReaderProxyTest : public ::testing::Test {
worker_thread_.reset();
}
- base::MessageLoopForIO message_loop_;
- content::TestBrowserThread io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
base::ScopedTempDir temp_dir_;
base::FilePath file_path_;
@@ -109,11 +108,10 @@ TEST_F(LocalReaderProxyTest, ReadWithLimit) {
class NetworkReaderProxyTest : public ::testing::Test {
protected:
- NetworkReaderProxyTest() : io_thread_(BrowserThread::IO, &message_loop_) {
+ NetworkReaderProxyTest() : thread_bundle_(IO_MAINLOOP) {
}
- base::MessageLoopForIO message_loop_;
- content::TestBrowserThread io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
};
TEST_F(NetworkReaderProxyTest, EmptyFile) {
@@ -288,39 +286,13 @@ TEST_F(NetworkReaderProxyTest, CancelJob) {
class DriveFileStreamReaderTest : public ::testing::Test {
protected:
- DriveFileStreamReaderTest()
- : ui_thread_(BrowserThread::UI),
- io_thread_(BrowserThread::IO, &message_loop_) {
+ DriveFileStreamReaderTest() : thread_bundle_(IO_MAINLOOP) {
}
virtual void SetUp() OVERRIDE {
- ui_thread_.Start();
-
worker_thread_.reset(new base::Thread("DriveFileStreamReaderTest"));
ASSERT_TRUE(worker_thread_->Start());
- BrowserThread::PostTaskAndReply(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&DriveFileStreamReaderTest::SetUpOnUIThread,
- base::Unretained(this)),
- base::MessageLoop::QuitClosure());
- message_loop_.Run();
- }
-
- virtual void TearDown() OVERRIDE {
- BrowserThread::PostTaskAndReply(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&DriveFileStreamReaderTest::TearDownOnUIThread,
- base::Unretained(this)),
- base::MessageLoop::QuitClosure());
- message_loop_.Run();
-
- worker_thread_.reset();
- }
-
- void SetUpOnUIThread() {
// Initialize FakeDriveService.
fake_drive_service_.reset(new google_apis::FakeDriveService);
fake_drive_service_->LoadResourceListForWapi(
@@ -334,9 +306,11 @@ class DriveFileStreamReaderTest : public ::testing::Test {
fake_file_system_->Initialize();
}
- void TearDownOnUIThread() {
+ virtual void TearDown() OVERRIDE {
fake_file_system_.reset();
fake_drive_service_.reset();
+
+ worker_thread_.reset();
}
FileSystemInterface* GetFileSystem() {
@@ -348,9 +322,7 @@ class DriveFileStreamReaderTest : public ::testing::Test {
base::Unretained(this));
}
- base::MessageLoopForIO message_loop_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<base::Thread> worker_thread_;

Powered by Google App Engine
This is Rietveld 408576698