| OLD | NEW |
| 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 #ifndef CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 | 11 |
| 12 namespace base { |
| 12 class MessageLoop; | 13 class MessageLoop; |
| 13 | |
| 14 namespace base { | |
| 15 class Thread; | 14 class Thread; |
| 16 } | 15 } |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 | 18 |
| 20 class TestBrowserThreadImpl; | 19 class TestBrowserThreadImpl; |
| 21 | 20 |
| 22 // A BrowserThread for unit tests; this lets unit tests in chrome/ create | 21 // A BrowserThread for unit tests; this lets unit tests in chrome/ create |
| 23 // BrowserThread instances. | 22 // BrowserThread instances. |
| 24 class TestBrowserThread { | 23 class TestBrowserThread { |
| 25 public: | 24 public: |
| 26 explicit TestBrowserThread(BrowserThread::ID identifier); | 25 explicit TestBrowserThread(BrowserThread::ID identifier); |
| 27 TestBrowserThread(BrowserThread::ID identifier, MessageLoop* message_loop); | 26 TestBrowserThread(BrowserThread::ID identifier, |
| 27 base::MessageLoop* message_loop); |
| 28 ~TestBrowserThread(); | 28 ~TestBrowserThread(); |
| 29 | 29 |
| 30 // We provide a subset of the capabilities of the Thread interface | 30 // We provide a subset of the capabilities of the Thread interface |
| 31 // to enable certain unit tests. To avoid a stronger dependency of | 31 // to enable certain unit tests. To avoid a stronger dependency of |
| 32 // the internals of BrowserThread, we do not provide the full Thread | 32 // the internals of BrowserThread, we do not provide the full Thread |
| 33 // interface. | 33 // interface. |
| 34 | 34 |
| 35 // Starts the thread with a generic message loop. | 35 // Starts the thread with a generic message loop. |
| 36 bool Start(); | 36 bool Start(); |
| 37 | 37 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 scoped_ptr<TestBrowserThreadImpl> impl_; | 52 scoped_ptr<TestBrowserThreadImpl> impl_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(TestBrowserThread); | 54 DISALLOW_COPY_AND_ASSIGN(TestBrowserThread); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace content | 57 } // namespace content |
| 58 | 58 |
| 59 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_ | 59 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_ |
| OLD | NEW |