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 #include "content/public/test/test_browser_thread.h" | 5 #include "content/public/test/test_browser_thread.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/notification_service_impl.h" | 10 #include "content/browser/notification_service_impl.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class TestBrowserThreadImpl : public BrowserThreadImpl { | 14 class TestBrowserThreadImpl : public BrowserThreadImpl { |
15 public: | 15 public: |
16 explicit TestBrowserThreadImpl(BrowserThread::ID identifier) | 16 explicit TestBrowserThreadImpl(BrowserThread::ID identifier) |
17 : BrowserThreadImpl(identifier), | 17 : BrowserThreadImpl(identifier), |
18 notification_service_(NULL) { | 18 notification_service_(NULL) { |
19 } | 19 } |
20 | 20 |
21 TestBrowserThreadImpl(BrowserThread::ID identifier, | 21 TestBrowserThreadImpl(BrowserThread::ID identifier, |
22 base::MessageLoop* message_loop) | 22 base::MessageLoop* message_loop) |
23 : BrowserThreadImpl(identifier, message_loop), | 23 : BrowserThreadImpl(identifier, message_loop), |
24 notification_service_(NULL) {} | 24 notification_service_(NULL) {} |
25 | 25 |
26 virtual ~TestBrowserThreadImpl() { | 26 ~TestBrowserThreadImpl() override { Stop(); } |
27 Stop(); | |
28 } | |
29 | 27 |
30 virtual void Init() override { | 28 void Init() override { |
31 notification_service_ = new NotificationServiceImpl; | 29 notification_service_ = new NotificationServiceImpl; |
32 BrowserThreadImpl::Init(); | 30 BrowserThreadImpl::Init(); |
33 } | 31 } |
34 | 32 |
35 virtual void CleanUp() override { | 33 void CleanUp() override { |
36 delete notification_service_; | 34 delete notification_service_; |
37 notification_service_ = NULL; | 35 notification_service_ = NULL; |
38 BrowserThreadImpl::CleanUp(); | 36 BrowserThreadImpl::CleanUp(); |
39 } | 37 } |
40 | 38 |
41 private: | 39 private: |
42 NotificationService* notification_service_; | 40 NotificationService* notification_service_; |
43 | 41 |
44 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadImpl); | 42 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadImpl); |
45 }; | 43 }; |
(...skipping 26 matching lines...) Expand all Loading... |
72 | 70 |
73 bool TestBrowserThread::IsRunning() { | 71 bool TestBrowserThread::IsRunning() { |
74 return impl_->IsRunning(); | 72 return impl_->IsRunning(); |
75 } | 73 } |
76 | 74 |
77 base::Thread* TestBrowserThread::DeprecatedGetThreadObject() { | 75 base::Thread* TestBrowserThread::DeprecatedGetThreadObject() { |
78 return impl_.get(); | 76 return impl_.get(); |
79 } | 77 } |
80 | 78 |
81 } // namespace content | 79 } // namespace content |
OLD | NEW |