OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TEST_TEST_BROWSER_THREAD_H_ | 5 #ifndef CONTENT_TEST_TEST_BROWSER_THREAD_H_ |
6 #define CONTENT_TEST_TEST_BROWSER_THREAD_H_ | 6 #define CONTENT_TEST_TEST_BROWSER_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 | 12 |
13 class MessageLoop; | 13 class MessageLoop; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class Thread; | 16 class Thread; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class TestBrowserThreadImpl; | 21 class BrowserThreadImpl; |
22 | 22 |
23 // A BrowserThread for unit tests; this lets unit tests in chrome/ | 23 // A BrowserThread for unit tests; this lets unit tests in chrome/ |
24 // create BrowserThread instances. | 24 // create BrowserThread instances. |
25 class TestBrowserThread { | 25 class TestBrowserThread { |
26 public: | 26 public: |
27 explicit TestBrowserThread(BrowserThread::ID identifier); | 27 explicit TestBrowserThread(BrowserThread::ID identifier); |
28 TestBrowserThread(BrowserThread::ID identifier, MessageLoop* message_loop); | 28 TestBrowserThread(BrowserThread::ID identifier, MessageLoop* message_loop); |
29 ~TestBrowserThread(); | 29 ~TestBrowserThread(); |
30 | 30 |
31 // We provide a subset of the capabilities of the Thread interface | 31 // We provide a subset of the capabilities of the Thread interface |
(...skipping 10 matching lines...) Expand all Loading... |
42 // Stops the thread. | 42 // Stops the thread. |
43 void Stop(); | 43 void Stop(); |
44 | 44 |
45 // Returns true if the thread is running. | 45 // Returns true if the thread is running. |
46 bool IsRunning(); | 46 bool IsRunning(); |
47 | 47 |
48 // Returns a Thread pointer for the thread. This should not be used | 48 // Returns a Thread pointer for the thread. This should not be used |
49 // in new tests. | 49 // in new tests. |
50 base::Thread* DeprecatedGetThreadObject(); | 50 base::Thread* DeprecatedGetThreadObject(); |
51 | 51 |
52 // Sets the message loop to use for the thread. This should not be | |
53 // used in new tests. | |
54 void DeprecatedSetMessageLoop(MessageLoop* loop); | |
55 | |
56 private: | 52 private: |
57 scoped_ptr<TestBrowserThreadImpl> impl_; | 53 scoped_ptr<BrowserThreadImpl> impl_; |
58 | 54 |
59 DISALLOW_COPY_AND_ASSIGN(TestBrowserThread); | 55 DISALLOW_COPY_AND_ASSIGN(TestBrowserThread); |
60 }; | 56 }; |
61 | 57 |
62 } // namespace content | 58 } // namespace content |
63 | 59 |
64 #endif // CONTENT_TEST_TEST_BROWSER_THREAD_H_ | 60 #endif // CONTENT_TEST_TEST_BROWSER_THREAD_H_ |
OLD | NEW |