OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/public/test/test_browser_thread_bundle.h" | |
6 | |
7 #include "base/run_loop.h" | |
8 | |
9 namespace content { | |
10 | |
11 TestBrowserThreadBundle::TestBrowserThreadBundle() | |
12 : ui_thread_(BrowserThread::UI, &message_loop_), | |
13 db_thread_(BrowserThread::DB, &message_loop_), | |
14 file_thread_(BrowserThread::FILE, &message_loop_), | |
15 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, | |
16 &message_loop_), | |
17 io_thread_(BrowserThread::IO, &message_loop_) { | |
Jeffrey Yasskin
2013/05/22 22:24:58
Did you find a way to deal with things DCHECK'ing
awong
2013/05/24 23:39:28
For now, the solution is to start a real IO thread
| |
18 } | |
19 | |
20 TestBrowserThreadBundle::TestBrowserThreadBundle(int real_threads_mask) | |
21 : ui_thread_(BrowserThread::UI, &message_loop_), | |
22 db_thread_(BrowserThread::DB, | |
23 real_threads_mask & REAL_DB_THREAD ? NULL : &message_loop_), | |
24 file_thread_(BrowserThread::FILE, | |
25 real_threads_mask & REAL_FILE_THREAD ? NULL : &message_loop_), | |
26 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, | |
27 real_threads_mask & REAL_FILE_USER_BLOCKING_THREAD ? | |
28 NULL : &message_loop_), | |
29 io_thread_(BrowserThread::IO, | |
30 real_threads_mask & REAL_IO_THREAD ? NULL : &message_loop_) { | |
31 if (real_threads_mask & REAL_DB_THREAD) { | |
32 db_thread_.Start(); | |
33 } | |
34 if (real_threads_mask & REAL_FILE_THREAD) { | |
35 file_thread_.Start(); | |
36 } | |
37 if (real_threads_mask & REAL_FILE_USER_BLOCKING_THREAD) { | |
38 file_user_blocking_thread_.Start(); | |
39 } | |
40 if (real_threads_mask & REAL_IO_THREAD) { | |
41 io_thread_.StartIOThread(); | |
42 } | |
43 } | |
44 | |
45 TestBrowserThreadBundle::~TestBrowserThreadBundle() { | |
46 base::RunLoop().RunUntilIdle(); | |
47 } | |
48 | |
49 } // namespace content | |
OLD | NEW |