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

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

Issue 9194005: gpu: reference target surfaces through a globally unique surface id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix more tests Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/test/mock_render_thread.h ('k') | content/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) 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 #include "content/test/mock_render_thread.h" 5 #include "content/test/mock_render_thread.h"
6 6
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "ipc/ipc_message_utils.h" 9 #include "ipc/ipc_message_utils.h"
10 #include "ipc/ipc_sync_message.h" 10 #include "ipc/ipc_sync_message.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 MockRenderThread::MockRenderThread() 15 MockRenderThread::MockRenderThread()
16 : routing_id_(0), opener_id_(0) { 16 : routing_id_(0), surface_id_(0), opener_id_(0) {
17 } 17 }
18 18
19 MockRenderThread::~MockRenderThread() { 19 MockRenderThread::~MockRenderThread() {
20 } 20 }
21 21
22 void MockRenderThread::VerifyRunJavaScriptMessageSend( 22 void MockRenderThread::VerifyRunJavaScriptMessageSend(
23 const string16& expected_alert_message) { 23 const string16& expected_alert_message) {
24 const IPC::Message* alert_msg = 24 const IPC::Message* alert_msg =
25 sink_.GetUniqueMessageMatching(ViewHostMsg_RunJavaScriptMessage::ID); 25 sink_.GetUniqueMessageMatching(ViewHostMsg_RunJavaScriptMessage::ID);
26 ASSERT_TRUE(alert_msg); 26 ASSERT_TRUE(alert_msg);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 #endif // OS_WIN 162 #endif // OS_WIN
163 163
164 void MockRenderThread::SendCloseMessage() { 164 void MockRenderThread::SendCloseMessage() {
165 ViewMsg_Close msg(routing_id_); 165 ViewMsg_Close msg(routing_id_);
166 widget_->OnMessageReceived(msg); 166 widget_->OnMessageReceived(msg);
167 } 167 }
168 168
169 // The Widget expects to be returned valid route_id. 169 // The Widget expects to be returned valid route_id.
170 void MockRenderThread::OnMsgCreateWidget(int opener_id, 170 void MockRenderThread::OnMsgCreateWidget(int opener_id,
171 WebKit::WebPopupType popup_type, 171 WebKit::WebPopupType popup_type,
172 int* route_id) { 172 int* route_id,
173 int* surface_id) {
173 opener_id_ = opener_id; 174 opener_id_ = opener_id;
174 *route_id = routing_id_; 175 *route_id = routing_id_;
176 *surface_id = surface_id_;
175 } 177 }
176 178
177 bool MockRenderThread::OnMessageReceived(const IPC::Message& msg) { 179 bool MockRenderThread::OnMessageReceived(const IPC::Message& msg) {
178 // Save the message in the sink. 180 // Save the message in the sink.
179 sink_.OnMessageReceived(msg); 181 sink_.OnMessageReceived(msg);
180 182
181 bool handled = true; 183 bool handled = true;
182 bool msg_is_ok = true; 184 bool msg_is_ok = true;
183 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok) 185 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok)
184 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) 186 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget)
185 IPC_MESSAGE_UNHANDLED(handled = false) 187 IPC_MESSAGE_UNHANDLED(handled = false)
186 IPC_END_MESSAGE_MAP_EX() 188 IPC_END_MESSAGE_MAP_EX()
187 return handled; 189 return handled;
188 } 190 }
189 191
190 #if defined(OS_WIN) 192 #if defined(OS_WIN)
191 void MockRenderThread::OnDuplicateSection( 193 void MockRenderThread::OnDuplicateSection(
192 base::SharedMemoryHandle renderer_handle, 194 base::SharedMemoryHandle renderer_handle,
193 base::SharedMemoryHandle* browser_handle) { 195 base::SharedMemoryHandle* browser_handle) {
194 // We don't have to duplicate the input handles since RenderViewTest does not 196 // We don't have to duplicate the input handles since RenderViewTest does not
195 // separate a browser process from a renderer process. 197 // separate a browser process from a renderer process.
196 *browser_handle = renderer_handle; 198 *browser_handle = renderer_handle;
197 } 199 }
198 #endif // defined(OS_WIN) 200 #endif // defined(OS_WIN)
199 201
200 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « content/test/mock_render_thread.h ('k') | content/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698