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