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

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_test_util.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 25 matching lines...) Expand all
36 36
37 MultiThreadTestHelper::MultiThreadTestHelper() 37 MultiThreadTestHelper::MultiThreadTestHelper()
38 : file_thread_(new base::Thread("File_Thread")), 38 : file_thread_(new base::Thread("File_Thread")),
39 io_thread_(new base::Thread("IO_Thread")) {} 39 io_thread_(new base::Thread("IO_Thread")) {}
40 40
41 MultiThreadTestHelper::~MultiThreadTestHelper() {} 41 MultiThreadTestHelper::~MultiThreadTestHelper() {}
42 42
43 void MultiThreadTestHelper::SetUp() { 43 void MultiThreadTestHelper::SetUp() {
44 file_thread_->Start(); 44 file_thread_->Start();
45 io_thread_->StartWithOptions( 45 io_thread_->StartWithOptions(
46 base::Thread::Options(MessageLoop::TYPE_IO, 0)); 46 base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
47 47
48 browser_ui_thread_.reset( 48 browser_ui_thread_.reset(
49 new TestBrowserThread(BrowserThread::UI, 49 new TestBrowserThread(BrowserThread::UI,
50 MessageLoop::current())); 50 base::MessageLoop::current()));
51 browser_file_thread_.reset( 51 browser_file_thread_.reset(
52 new TestBrowserThread(BrowserThread::FILE, 52 new TestBrowserThread(BrowserThread::FILE,
53 file_thread_->message_loop())); 53 file_thread_->message_loop()));
54 browser_io_thread_.reset( 54 browser_io_thread_.reset(
55 new TestBrowserThread(BrowserThread::IO, 55 new TestBrowserThread(BrowserThread::IO,
56 io_thread_->message_loop())); 56 io_thread_->message_loop()));
57 57
58 ui_task_runner_ = 58 ui_task_runner_ =
59 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); 59 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
60 file_task_runner_ = 60 file_task_runner_ =
61 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); 61 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE);
62 io_task_runner_ = 62 io_task_runner_ =
63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
64 } 64 }
65 65
66 void MultiThreadTestHelper::TearDown() { 66 void MultiThreadTestHelper::TearDown() {
67 // Make sure we give some more time to finish tasks on the FILE thread 67 // Make sure we give some more time to finish tasks on the FILE thread
68 // before stopping IO/FILE threads. 68 // before stopping IO/FILE threads.
69 base::RunLoop run_loop; 69 base::RunLoop run_loop;
70 file_task_runner_->PostTaskAndReply( 70 file_task_runner_->PostTaskAndReply(
71 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure()); 71 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure());
72 run_loop.Run(); 72 run_loop.Run();
73 73
74 io_thread_->Stop(); 74 io_thread_->Stop();
75 file_thread_->Stop(); 75 file_thread_->Stop();
76 } 76 }
77 77
78 } // namespace sync_file_system 78 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698