| 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 // TestBrowserThreadBundle is a convenience class for creating a set of | 5 // TestBrowserThreadBundle is a convenience class for creating a set of |
| 6 // TestBrowserThreads in unit tests. For most tests, it is sufficient to | 6 // TestBrowserThreads in unit tests. For most tests, it is sufficient to |
| 7 // just instantiate the TestBrowserThreadBundle as a member variable. | 7 // just instantiate the TestBrowserThreadBundle as a member variable. |
| 8 // | 8 // |
| 9 // By default, all of the created TestBrowserThreads will be backed by a single | 9 // By default, all of the created TestBrowserThreads will be backed by a single |
| 10 // shared MessageLoop. If a test truly needs separate threads, it can do | 10 // shared MessageLoop. If a test truly needs separate threads, it can do |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class TestBrowserThreadBundle { | 38 class TestBrowserThreadBundle { |
| 39 public: | 39 public: |
| 40 // Used to specify the type of MessageLoop that backs the UI thread, and | 40 // Used to specify the type of MessageLoop that backs the UI thread, and |
| 41 // which of the named BrowserThreads should be backed by a real | 41 // which of the named BrowserThreads should be backed by a real |
| 42 // threads. The UI thread is always the main thread in a unit test. | 42 // threads. The UI thread is always the main thread in a unit test. |
| 43 enum Options { | 43 enum Options { |
| 44 DEFAULT = 0x00, | 44 DEFAULT = 0x00, |
| 45 IO_MAINLOOP = 0x01, | 45 IO_MAINLOOP = 0x01, |
| 46 REAL_DB_THREAD = 0x02, | 46 REAL_DB_THREAD = 0x02, |
| 47 REAL_WEBKIT_DEPRECATED_THREAD = 0x04, | |
| 48 REAL_FILE_THREAD = 0x08, | 47 REAL_FILE_THREAD = 0x08, |
| 49 REAL_FILE_USER_BLOCKING_THREAD = 0x10, | 48 REAL_FILE_USER_BLOCKING_THREAD = 0x10, |
| 50 REAL_PROCESS_LAUNCHER_THREAD = 0x20, | 49 REAL_PROCESS_LAUNCHER_THREAD = 0x20, |
| 51 REAL_CACHE_THREAD = 0x40, | 50 REAL_CACHE_THREAD = 0x40, |
| 52 REAL_IO_THREAD = 0x80, | 51 REAL_IO_THREAD = 0x80, |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 TestBrowserThreadBundle(); | 54 TestBrowserThreadBundle(); |
| 56 explicit TestBrowserThreadBundle(int options); | 55 explicit TestBrowserThreadBundle(int options); |
| 57 | 56 |
| 58 ~TestBrowserThreadBundle(); | 57 ~TestBrowserThreadBundle(); |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 void Init(int options); | 60 void Init(int options); |
| 62 | 61 |
| 63 scoped_ptr<base::MessageLoop> message_loop_; | 62 scoped_ptr<base::MessageLoop> message_loop_; |
| 64 scoped_ptr<TestBrowserThread> ui_thread_; | 63 scoped_ptr<TestBrowserThread> ui_thread_; |
| 65 scoped_ptr<TestBrowserThread> db_thread_; | 64 scoped_ptr<TestBrowserThread> db_thread_; |
| 66 scoped_ptr<TestBrowserThread> webkit_deprecated_thread_; | |
| 67 scoped_ptr<TestBrowserThread> file_thread_; | 65 scoped_ptr<TestBrowserThread> file_thread_; |
| 68 scoped_ptr<TestBrowserThread> file_user_blocking_thread_; | 66 scoped_ptr<TestBrowserThread> file_user_blocking_thread_; |
| 69 scoped_ptr<TestBrowserThread> process_launcher_thread_; | 67 scoped_ptr<TestBrowserThread> process_launcher_thread_; |
| 70 scoped_ptr<TestBrowserThread> cache_thread_; | 68 scoped_ptr<TestBrowserThread> cache_thread_; |
| 71 scoped_ptr<TestBrowserThread> io_thread_; | 69 scoped_ptr<TestBrowserThread> io_thread_; |
| 72 | 70 |
| 73 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadBundle); | 71 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadBundle); |
| 74 }; | 72 }; |
| 75 | 73 |
| 76 } // namespace content | 74 } // namespace content |
| 77 | 75 |
| 78 #endif /* CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_TEST_BUNDLE_H_ */ | 76 #endif /* CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_TEST_BUNDLE_H_ */ |
| OLD | NEW |