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 CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ |
6 #define CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/public/test/mock_render_thread.h" | 11 #include "content/public/test/mock_render_thread.h" |
12 | 12 |
13 struct ExtensionMsg_ExternalConnectionInfo; | 13 struct ExtensionMsg_ExternalConnectionInfo; |
14 | 14 |
15 // Extends content::MockRenderThread to know about extension messages. | 15 // Extends content::MockRenderThread to know about extension messages. |
16 class ChromeMockRenderThread : public content::MockRenderThread { | 16 class ChromeMockRenderThread : public content::MockRenderThread { |
17 public: | 17 public: |
18 ChromeMockRenderThread(); | 18 ChromeMockRenderThread(); |
19 ~ChromeMockRenderThread() override; | 19 ~ChromeMockRenderThread() override; |
20 | 20 |
21 // content::RenderThread overrides. | 21 // content::RenderThread overrides. |
22 scoped_refptr<base::SingleThreadTaskRunner> GetIOMessageLoopProxy() override; | 22 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override; |
23 | 23 |
24 ////////////////////////////////////////////////////////////////////////// | 24 ////////////////////////////////////////////////////////////////////////// |
25 // The following functions are called by the test itself. | 25 // The following functions are called by the test itself. |
26 | 26 |
27 // Set IO message loop proxy. | 27 void set_io_task_runner( |
28 void set_io_message_loop_proxy( | |
29 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 28 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
30 | 29 |
31 private: | 30 private: |
32 // Overrides base class implementation to add custom handling for | 31 // Overrides base class implementation to add custom handling for |
33 // print and extensions. | 32 // print and extensions. |
34 bool OnMessageReceived(const IPC::Message& msg) override; | 33 bool OnMessageReceived(const IPC::Message& msg) override; |
35 | 34 |
36 #if defined(ENABLE_EXTENSIONS) | 35 #if defined(ENABLE_EXTENSIONS) |
37 // The callee expects to be returned a valid channel_id. | 36 // The callee expects to be returned a valid channel_id. |
38 void OnOpenChannelToExtension(int routing_id, | 37 void OnOpenChannelToExtension(int routing_id, |
39 const ExtensionMsg_ExternalConnectionInfo& info, | 38 const ExtensionMsg_ExternalConnectionInfo& info, |
40 const std::string& channel_name, | 39 const std::string& channel_name, |
41 bool include_tls_channel_id, | 40 bool include_tls_channel_id, |
42 int* port_id); | 41 int* port_id); |
43 #endif | 42 #endif |
44 | 43 |
45 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 44 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
46 | 45 |
47 DISALLOW_COPY_AND_ASSIGN(ChromeMockRenderThread); | 46 DISALLOW_COPY_AND_ASSIGN(ChromeMockRenderThread); |
48 }; | 47 }; |
49 | 48 |
50 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 49 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ |
OLD | NEW |