Chromium Code Reviews| Index: content/public/test/test_browser_thread_bundle.cc |
| diff --git a/content/public/test/test_browser_thread_bundle.cc b/content/public/test/test_browser_thread_bundle.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a1882c78c2171ea56284531eeb70b954120594df |
| --- /dev/null |
| +++ b/content/public/test/test_browser_thread_bundle.cc |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/public/test/test_browser_thread_bundle.h" |
| + |
| +#include "base/run_loop.h" |
| + |
| +namespace content { |
| + |
| +TestBrowserThreadBundle::TestBrowserThreadBundle() |
| + : ui_thread_(BrowserThread::UI, &message_loop_), |
| + db_thread_(BrowserThread::DB, &message_loop_), |
| + file_thread_(BrowserThread::FILE, &message_loop_), |
| + file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, |
| + &message_loop_), |
| + io_thread_(BrowserThread::IO, &message_loop_) { |
| +} |
| + |
| +TestBrowserThreadBundle::TestBrowserThreadBundle(int real_threads_mask) |
| + : ui_thread_(BrowserThread::UI, &message_loop_), |
| + db_thread_(BrowserThread::DB, |
| + real_threads_mask & REAL_DB_THREAD ? NULL : &message_loop_), |
| + file_thread_(BrowserThread::FILE, |
| + real_threads_mask & REAL_FILE_THREAD ? NULL : &message_loop_), |
|
jam
2013/05/31 17:29:25
nit: here and below, indentation
awong
2013/05/31 20:57:17
Done.
|
| + file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, |
| + real_threads_mask & REAL_FILE_USER_BLOCKING_THREAD ? |
| + NULL : &message_loop_), |
| + io_thread_(BrowserThread::IO, |
| + real_threads_mask & REAL_IO_THREAD ? NULL : &message_loop_) { |
| + if (real_threads_mask & REAL_DB_THREAD) { |
| + db_thread_.Start(); |
| + } |
| + if (real_threads_mask & REAL_FILE_THREAD) { |
| + file_thread_.Start(); |
| + } |
| + if (real_threads_mask & REAL_FILE_USER_BLOCKING_THREAD) { |
| + file_user_blocking_thread_.Start(); |
| + } |
| + if (real_threads_mask & REAL_IO_THREAD) { |
| + io_thread_.StartIOThread(); |
| + } |
| +} |
| + |
| +TestBrowserThreadBundle::~TestBrowserThreadBundle() { |
| + base::RunLoop().RunUntilIdle(); |
| +} |
| + |
| +} // namespace content |