OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_TEST_TEST_THREAD_SAFE_SENDER_H_ |
| 6 #define CONTENT_TEST_TEST_THREAD_SAFE_SENDER_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/child/thread_safe_sender.h" |
| 11 |
| 12 namespace IPC { |
| 13 class SyncChannel; |
| 14 } |
| 15 |
| 16 namespace base { |
| 17 class SingleThreadTaskRunner; |
| 18 class Thread; |
| 19 class WaitableEvent; |
| 20 } |
| 21 |
| 22 namespace content { |
| 23 |
| 24 // This provides an implementation of ThreadSafeSender to be used from unit |
| 25 // tests. This creates its on IO thread and IPC::SyncChannel and controls their |
| 26 // lifetime. |
| 27 class TestThreadSafeSender : public ThreadSafeSender { |
| 28 public: |
| 29 static scoped_refptr<ThreadSafeSender> Create( |
| 30 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); |
| 31 |
| 32 private: |
| 33 friend class base::RefCountedThreadSafe<ThreadSafeSender>; |
| 34 |
| 35 TestThreadSafeSender( |
| 36 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
| 37 scoped_ptr<base::Thread> io_thread, |
| 38 scoped_ptr<base::WaitableEvent> shutdown_event, |
| 39 scoped_ptr<IPC::SyncChannel> sync_channel); |
| 40 ~TestThreadSafeSender() override; |
| 41 |
| 42 scoped_ptr<base::Thread> io_thread_; |
| 43 scoped_ptr<base::WaitableEvent> shutdown_event_; |
| 44 scoped_ptr<IPC::SyncChannel> sync_channel_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(TestThreadSafeSender); |
| 47 }; |
| 48 |
| 49 } // namespace content |
| 50 |
| 51 #endif // CONTENT_TEST_TEST_THREAD_SAFE_SENDER_H_ |
OLD | NEW |