Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: content/public/test/mock_render_thread.cc

Issue 1359163005: Remove surface_id from RenderWidget/RenderWidgetHost and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel_creation_preempt
Patch Set: fix more tests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/test/mock_render_thread.h ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/public/test/mock_render_thread.h" 5 #include "content/public/test/mock_render_thread.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "content/common/frame_messages.h" 9 #include "content/common/frame_messages.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
11 #include "content/public/renderer/render_process_observer.h" 11 #include "content/public/renderer/render_process_observer.h"
12 #include "content/renderer/render_view_impl.h" 12 #include "content/renderer/render_view_impl.h"
13 #include "ipc/ipc_message_utils.h" 13 #include "ipc/ipc_message_utils.h"
14 #include "ipc/ipc_sync_message.h" 14 #include "ipc/ipc_sync_message.h"
15 #include "ipc/message_filter.h" 15 #include "ipc/message_filter.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "third_party/WebKit/public/web/WebScriptController.h" 17 #include "third_party/WebKit/public/web/WebScriptController.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 MockRenderThread::MockRenderThread() 21 MockRenderThread::MockRenderThread()
22 : routing_id_(0), 22 : routing_id_(0),
23 surface_id_(0),
24 opener_id_(0), 23 opener_id_(0),
25 new_window_routing_id_(0), 24 new_window_routing_id_(0),
26 new_window_main_frame_routing_id_(0), 25 new_window_main_frame_routing_id_(0),
27 new_frame_routing_id_(0) { 26 new_frame_routing_id_(0) {
28 } 27 }
29 28
30 MockRenderThread::~MockRenderThread() { 29 MockRenderThread::~MockRenderThread() {
31 while (!filters_.empty()) { 30 while (!filters_.empty()) {
32 scoped_refptr<IPC::MessageFilter> filter = filters_.back(); 31 scoped_refptr<IPC::MessageFilter> filter = filters_.back();
33 filters_.pop_back(); 32 filters_.pop_back();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 193 }
195 194
196 void MockRenderThread::SendCloseMessage() { 195 void MockRenderThread::SendCloseMessage() {
197 ViewMsg_Close msg(routing_id_); 196 ViewMsg_Close msg(routing_id_);
198 RenderViewImpl::FromRoutingID(routing_id_)->OnMessageReceived(msg); 197 RenderViewImpl::FromRoutingID(routing_id_)->OnMessageReceived(msg);
199 } 198 }
200 199
201 // The Widget expects to be returned valid route_id. 200 // The Widget expects to be returned valid route_id.
202 void MockRenderThread::OnCreateWidget(int opener_id, 201 void MockRenderThread::OnCreateWidget(int opener_id,
203 blink::WebPopupType popup_type, 202 blink::WebPopupType popup_type,
204 int* route_id, 203 int* route_id) {
205 int* surface_id) {
206 opener_id_ = opener_id; 204 opener_id_ = opener_id;
207 *route_id = routing_id_; 205 *route_id = routing_id_;
208 *surface_id = surface_id_;
209 } 206 }
210 207
211 // The View expects to be returned a valid route_id different from its own. 208 // The View expects to be returned a valid route_id different from its own.
212 void MockRenderThread::OnCreateWindow( 209 void MockRenderThread::OnCreateWindow(
213 const ViewHostMsg_CreateWindow_Params& params, 210 const ViewHostMsg_CreateWindow_Params& params,
214 int* route_id, 211 int* route_id,
215 int* main_frame_route_id, 212 int* main_frame_route_id,
216 int* surface_id,
217 int64* cloned_session_storage_namespace_id) { 213 int64* cloned_session_storage_namespace_id) {
218 *route_id = new_window_routing_id_; 214 *route_id = new_window_routing_id_;
219 *main_frame_route_id = new_window_main_frame_routing_id_; 215 *main_frame_route_id = new_window_main_frame_routing_id_;
220 *surface_id = surface_id_;
221 *cloned_session_storage_namespace_id = 0; 216 *cloned_session_storage_namespace_id = 0;
222 } 217 }
223 218
224 // The Frame expects to be returned a valid route_id different from its own. 219 // The Frame expects to be returned a valid route_id different from its own.
225 void MockRenderThread::OnCreateChildFrame(int new_frame_routing_id, 220 void MockRenderThread::OnCreateChildFrame(int new_frame_routing_id,
226 blink::WebTreeScopeType scope, 221 blink::WebTreeScopeType scope,
227 const std::string& frame_name, 222 const std::string& frame_name,
228 blink::WebSandboxFlags sandbox_flags, 223 blink::WebSandboxFlags sandbox_flags,
229 int* new_render_frame_id) { 224 int* new_render_frame_id) {
230 *new_render_frame_id = new_frame_routing_id_++; 225 *new_render_frame_id = new_frame_routing_id_++;
(...skipping 27 matching lines...) Expand all
258 void MockRenderThread::OnDuplicateSection( 253 void MockRenderThread::OnDuplicateSection(
259 base::SharedMemoryHandle renderer_handle, 254 base::SharedMemoryHandle renderer_handle,
260 base::SharedMemoryHandle* browser_handle) { 255 base::SharedMemoryHandle* browser_handle) {
261 // We don't have to duplicate the input handles since RenderViewTest does not 256 // We don't have to duplicate the input handles since RenderViewTest does not
262 // separate a browser process from a renderer process. 257 // separate a browser process from a renderer process.
263 *browser_handle = renderer_handle; 258 *browser_handle = renderer_handle;
264 } 259 }
265 #endif // defined(OS_WIN) 260 #endif // defined(OS_WIN)
266 261
267 } // namespace content 262 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_render_thread.h ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698