OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/public/test/test_browser_thread_bundle.h" | 5 #include "content/public/test/test_browser_thread_bundle.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 io_thread_.reset(); | 27 io_thread_.reset(); |
28 base::RunLoop().RunUntilIdle(); | 28 base::RunLoop().RunUntilIdle(); |
29 cache_thread_.reset(); | 29 cache_thread_.reset(); |
30 base::RunLoop().RunUntilIdle(); | 30 base::RunLoop().RunUntilIdle(); |
31 process_launcher_thread_.reset(); | 31 process_launcher_thread_.reset(); |
32 base::RunLoop().RunUntilIdle(); | 32 base::RunLoop().RunUntilIdle(); |
33 file_user_blocking_thread_.reset(); | 33 file_user_blocking_thread_.reset(); |
34 base::RunLoop().RunUntilIdle(); | 34 base::RunLoop().RunUntilIdle(); |
35 file_thread_.reset(); | 35 file_thread_.reset(); |
36 base::RunLoop().RunUntilIdle(); | 36 base::RunLoop().RunUntilIdle(); |
37 webkit_deprecated_thread_.reset(); | |
38 base::RunLoop().RunUntilIdle(); | |
39 db_thread_.reset(); | 37 db_thread_.reset(); |
40 base::RunLoop().RunUntilIdle(); | 38 base::RunLoop().RunUntilIdle(); |
41 ui_thread_.reset(); | 39 ui_thread_.reset(); |
42 base::RunLoop().RunUntilIdle(); | 40 base::RunLoop().RunUntilIdle(); |
43 } | 41 } |
44 | 42 |
45 void TestBrowserThreadBundle::Init(int options) { | 43 void TestBrowserThreadBundle::Init(int options) { |
46 if (options & IO_MAINLOOP) { | 44 if (options & IO_MAINLOOP) { |
47 message_loop_.reset(new base::MessageLoopForIO()); | 45 message_loop_.reset(new base::MessageLoopForIO()); |
48 } else { | 46 } else { |
49 message_loop_.reset(new base::MessageLoopForUI()); | 47 message_loop_.reset(new base::MessageLoopForUI()); |
50 } | 48 } |
51 | 49 |
52 ui_thread_.reset(new TestBrowserThread(BrowserThread::UI, | 50 ui_thread_.reset(new TestBrowserThread(BrowserThread::UI, |
53 message_loop_.get())); | 51 message_loop_.get())); |
54 | 52 |
55 if (options & REAL_DB_THREAD) { | 53 if (options & REAL_DB_THREAD) { |
56 db_thread_.reset(new TestBrowserThread(BrowserThread::DB)); | 54 db_thread_.reset(new TestBrowserThread(BrowserThread::DB)); |
57 db_thread_->Start(); | 55 db_thread_->Start(); |
58 } else { | 56 } else { |
59 db_thread_.reset(new TestBrowserThread(BrowserThread::DB, | 57 db_thread_.reset(new TestBrowserThread(BrowserThread::DB, |
60 message_loop_.get())); | 58 message_loop_.get())); |
61 } | 59 } |
62 | 60 |
63 if (options & REAL_WEBKIT_DEPRECATED_THREAD) { | |
64 webkit_deprecated_thread_.reset( | |
65 new TestBrowserThread(BrowserThread::WEBKIT_DEPRECATED)); | |
66 webkit_deprecated_thread_->Start(); | |
67 } else { | |
68 webkit_deprecated_thread_.reset( | |
69 new TestBrowserThread(BrowserThread::WEBKIT_DEPRECATED, | |
70 message_loop_.get())); | |
71 } | |
72 | |
73 if (options & REAL_FILE_THREAD) { | 61 if (options & REAL_FILE_THREAD) { |
74 file_thread_.reset(new TestBrowserThread(BrowserThread::FILE)); | 62 file_thread_.reset(new TestBrowserThread(BrowserThread::FILE)); |
75 file_thread_->Start(); | 63 file_thread_->Start(); |
76 } else { | 64 } else { |
77 file_thread_.reset(new TestBrowserThread(BrowserThread::FILE, | 65 file_thread_.reset(new TestBrowserThread(BrowserThread::FILE, |
78 message_loop_.get())); | 66 message_loop_.get())); |
79 } | 67 } |
80 | 68 |
81 if (options & REAL_FILE_USER_BLOCKING_THREAD) { | 69 if (options & REAL_FILE_USER_BLOCKING_THREAD) { |
82 file_user_blocking_thread_.reset( | 70 file_user_blocking_thread_.reset( |
(...skipping 26 matching lines...) Expand all Loading... |
109 if (options & REAL_IO_THREAD) { | 97 if (options & REAL_IO_THREAD) { |
110 io_thread_.reset(new TestBrowserThread(BrowserThread::IO)); | 98 io_thread_.reset(new TestBrowserThread(BrowserThread::IO)); |
111 io_thread_->StartIOThread(); | 99 io_thread_->StartIOThread(); |
112 } else { | 100 } else { |
113 io_thread_.reset( | 101 io_thread_.reset( |
114 new TestBrowserThread(BrowserThread::IO, message_loop_.get())); | 102 new TestBrowserThread(BrowserThread::IO, message_loop_.get())); |
115 } | 103 } |
116 } | 104 } |
117 | 105 |
118 } // namespace content | 106 } // namespace content |
OLD | NEW |