| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #endif | 78 #endif |
| 79 ServiceRegistry* GetServiceRegistry() override; | 79 ServiceRegistry* GetServiceRegistry() override; |
| 80 | 80 |
| 81 ////////////////////////////////////////////////////////////////////////// | 81 ////////////////////////////////////////////////////////////////////////// |
| 82 // The following functions are called by the test itself. | 82 // The following functions are called by the test itself. |
| 83 | 83 |
| 84 void set_routing_id(int32 id) { | 84 void set_routing_id(int32 id) { |
| 85 routing_id_ = id; | 85 routing_id_ = id; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void set_surface_id(int32 id) { | |
| 89 surface_id_ = id; | |
| 90 } | |
| 91 | |
| 92 int32 opener_id() const { | 88 int32 opener_id() const { |
| 93 return opener_id_; | 89 return opener_id_; |
| 94 } | 90 } |
| 95 | 91 |
| 96 void set_new_window_routing_id(int32 id) { | 92 void set_new_window_routing_id(int32 id) { |
| 97 new_window_routing_id_ = id; | 93 new_window_routing_id_ = id; |
| 98 } | 94 } |
| 99 | 95 |
| 100 void set_new_frame_routing_id(int32 id) { | 96 void set_new_frame_routing_id(int32 id) { |
| 101 new_frame_routing_id_ = id; | 97 new_frame_routing_id_ = id; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 112 base::ObserverList<RenderProcessObserver>& observers() { return observers_; } | 108 base::ObserverList<RenderProcessObserver>& observers() { return observers_; } |
| 113 | 109 |
| 114 protected: | 110 protected: |
| 115 // This function operates as a regular IPC listener. Subclasses | 111 // This function operates as a regular IPC listener. Subclasses |
| 116 // overriding this should first delegate to this implementation. | 112 // overriding this should first delegate to this implementation. |
| 117 virtual bool OnMessageReceived(const IPC::Message& msg); | 113 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 118 | 114 |
| 119 // The Widget expects to be returned valid route_id. | 115 // The Widget expects to be returned valid route_id. |
| 120 void OnCreateWidget(int opener_id, | 116 void OnCreateWidget(int opener_id, |
| 121 blink::WebPopupType popup_type, | 117 blink::WebPopupType popup_type, |
| 122 int* route_id, | 118 int* route_id); |
| 123 int* surface_id); | |
| 124 | 119 |
| 125 // The View expects to be returned a valid route_id different from its own. | 120 // The View expects to be returned a valid route_id different from its own. |
| 126 // We do not keep track of the newly created widget in MockRenderThread, | 121 // We do not keep track of the newly created widget in MockRenderThread, |
| 127 // so it must be cleaned up on its own. | 122 // so it must be cleaned up on its own. |
| 128 void OnCreateWindow( | 123 void OnCreateWindow( |
| 129 const ViewHostMsg_CreateWindow_Params& params, | 124 const ViewHostMsg_CreateWindow_Params& params, |
| 130 int* route_id, | 125 int* route_id, |
| 131 int* main_frame_route_id, | 126 int* main_frame_route_id, |
| 132 int* surface_id, | |
| 133 int64* cloned_session_storage_namespace_id); | 127 int64* cloned_session_storage_namespace_id); |
| 134 | 128 |
| 135 // The Frame expects to be returned a valid route_id different from its own. | 129 // The Frame expects to be returned a valid route_id different from its own. |
| 136 void OnCreateChildFrame(int new_frame_routing_id, | 130 void OnCreateChildFrame(int new_frame_routing_id, |
| 137 blink::WebTreeScopeType scope, | 131 blink::WebTreeScopeType scope, |
| 138 const std::string& frame_name, | 132 const std::string& frame_name, |
| 139 blink::WebSandboxFlags sandbox_flags, | 133 blink::WebSandboxFlags sandbox_flags, |
| 140 int* new_render_frame_id); | 134 int* new_render_frame_id); |
| 141 | 135 |
| 142 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
| 143 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, | 137 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, |
| 144 base::SharedMemoryHandle* browser_handle); | 138 base::SharedMemoryHandle* browser_handle); |
| 145 #endif | 139 #endif |
| 146 | 140 |
| 147 IPC::TestSink sink_; | 141 IPC::TestSink sink_; |
| 148 | 142 |
| 149 // Routing id what will be assigned to the Widget. | 143 // Routing id what will be assigned to the Widget. |
| 150 int32 routing_id_; | 144 int32 routing_id_; |
| 151 | 145 |
| 152 // Surface id what will be assigned to the Widget. | |
| 153 int32 surface_id_; | |
| 154 | |
| 155 // Opener id reported by the Widget. | 146 // Opener id reported by the Widget. |
| 156 int32 opener_id_; | 147 int32 opener_id_; |
| 157 | 148 |
| 158 // Routing id that will be assigned to a CreateWindow Widget. | 149 // Routing id that will be assigned to a CreateWindow Widget. |
| 159 int32 new_window_routing_id_; | 150 int32 new_window_routing_id_; |
| 160 int32 new_window_main_frame_routing_id_; | 151 int32 new_window_main_frame_routing_id_; |
| 161 int32 new_frame_routing_id_; | 152 int32 new_frame_routing_id_; |
| 162 | 153 |
| 163 // The last known good deserializer for sync messages. | 154 // The last known good deserializer for sync messages. |
| 164 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 155 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
| 165 | 156 |
| 166 // A list of message filters added to this thread. | 157 // A list of message filters added to this thread. |
| 167 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; | 158 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; |
| 168 | 159 |
| 169 // Observers to notify. | 160 // Observers to notify. |
| 170 base::ObserverList<RenderProcessObserver> observers_; | 161 base::ObserverList<RenderProcessObserver> observers_; |
| 171 | 162 |
| 172 cc::TestSharedBitmapManager shared_bitmap_manager_; | 163 cc::TestSharedBitmapManager shared_bitmap_manager_; |
| 173 }; | 164 }; |
| 174 | 165 |
| 175 } // namespace content | 166 } // namespace content |
| 176 | 167 |
| 177 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 168 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |