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

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

Issue 133483002: Fix idle handlers not being called. The problem was that RenderThread::AddRoute was assuming that e… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 6 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/public/test/mock_render_thread.h ('k') | content/renderer/render_thread_impl.h » ('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/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "content/common/frame_messages.h" 8 #include "content/common/frame_messages.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/renderer/render_process_observer.h" 10 #include "content/public/renderer/render_process_observer.h"
11 #include "content/renderer/render_view_impl.h"
11 #include "ipc/ipc_message_utils.h" 12 #include "ipc/ipc_message_utils.h"
12 #include "ipc/ipc_sync_message.h" 13 #include "ipc/ipc_sync_message.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/WebKit/public/web/WebScriptController.h" 15 #include "third_party/WebKit/public/web/WebScriptController.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 MockRenderThread::MockRenderThread() 19 MockRenderThread::MockRenderThread()
19 : routing_id_(0), 20 : routing_id_(0),
20 surface_id_(0), 21 surface_id_(0),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 IPC::SyncMessageFilter* MockRenderThread::GetSyncMessageFilter() { 82 IPC::SyncMessageFilter* MockRenderThread::GetSyncMessageFilter() {
82 return NULL; 83 return NULL;
83 } 84 }
84 85
85 scoped_refptr<base::MessageLoopProxy> 86 scoped_refptr<base::MessageLoopProxy>
86 MockRenderThread::GetIOMessageLoopProxy() { 87 MockRenderThread::GetIOMessageLoopProxy() {
87 return scoped_refptr<base::MessageLoopProxy>(); 88 return scoped_refptr<base::MessageLoopProxy>();
88 } 89 }
89 90
90 void MockRenderThread::AddRoute(int32 routing_id, IPC::Listener* listener) { 91 void MockRenderThread::AddRoute(int32 routing_id, IPC::Listener* listener) {
91 // We may hear this for views created from OnCreateWindow as well,
92 // in which case we don't want to track the new widget.
93 if (routing_id_ == routing_id)
94 widget_ = listener;
95 } 92 }
96 93
97 void MockRenderThread::RemoveRoute(int32 routing_id) { 94 void MockRenderThread::RemoveRoute(int32 routing_id) {
98 // We may hear this for views created from OnCreateWindow as well,
99 // in which case we don't want to track the new widget.
100 if (routing_id_ == routing_id)
101 widget_ = NULL;
102 } 95 }
103 96
104 int MockRenderThread::GenerateRoutingID() { 97 int MockRenderThread::GenerateRoutingID() {
105 NOTREACHED(); 98 NOTREACHED();
106 return MSG_ROUTING_NONE; 99 return MSG_ROUTING_NONE;
107 } 100 }
108 101
109 void MockRenderThread::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { 102 void MockRenderThread::AddFilter(IPC::ChannelProxy::MessageFilter* filter) {
110 filter->OnFilterAdded(&sink()); 103 filter->OnFilterAdded(&sink());
111 // Add this filter to a vector so the MockRenderThread::RemoveFilter function 104 // Add this filter to a vector so the MockRenderThread::RemoveFilter function
(...skipping 18 matching lines...) Expand all
130 } 123 }
131 124
132 void MockRenderThread::RemoveObserver(RenderProcessObserver* observer) { 125 void MockRenderThread::RemoveObserver(RenderProcessObserver* observer) {
133 observers_.RemoveObserver(observer); 126 observers_.RemoveObserver(observer);
134 } 127 }
135 128
136 void MockRenderThread::SetResourceDispatcherDelegate( 129 void MockRenderThread::SetResourceDispatcherDelegate(
137 ResourceDispatcherDelegate* delegate) { 130 ResourceDispatcherDelegate* delegate) {
138 } 131 }
139 132
140 void MockRenderThread::WidgetHidden() {
141 }
142
143 void MockRenderThread::WidgetRestored() {
144 }
145
146 void MockRenderThread::EnsureWebKitInitialized() { 133 void MockRenderThread::EnsureWebKitInitialized() {
147 } 134 }
148 135
149 void MockRenderThread::RecordAction(const UserMetricsAction& action) { 136 void MockRenderThread::RecordAction(const UserMetricsAction& action) {
150 } 137 }
151 138
152 void MockRenderThread::RecordComputedAction(const std::string& action) { 139 void MockRenderThread::RecordComputedAction(const std::string& action) {
153 } 140 }
154 141
155 scoped_ptr<base::SharedMemory> 142 scoped_ptr<base::SharedMemory>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void MockRenderThread::PreCacheFont(const LOGFONT& log_font) { 187 void MockRenderThread::PreCacheFont(const LOGFONT& log_font) {
201 } 188 }
202 189
203 void MockRenderThread::ReleaseCachedFonts() { 190 void MockRenderThread::ReleaseCachedFonts() {
204 } 191 }
205 192
206 #endif // OS_WIN 193 #endif // OS_WIN
207 194
208 void MockRenderThread::SendCloseMessage() { 195 void MockRenderThread::SendCloseMessage() {
209 ViewMsg_Close msg(routing_id_); 196 ViewMsg_Close msg(routing_id_);
210 widget_->OnMessageReceived(msg); 197 RenderViewImpl::FromRoutingID(routing_id_)->OnMessageReceived(msg);
211 } 198 }
212 199
213 // The Widget expects to be returned valid route_id. 200 // The Widget expects to be returned valid route_id.
214 void MockRenderThread::OnCreateWidget(int opener_id, 201 void MockRenderThread::OnCreateWidget(int opener_id,
215 blink::WebPopupType popup_type, 202 blink::WebPopupType popup_type,
216 int* route_id, 203 int* route_id,
217 int* surface_id) { 204 int* surface_id) {
218 opener_id_ = opener_id; 205 opener_id_ = opener_id;
219 *route_id = routing_id_; 206 *route_id = routing_id_;
220 *surface_id = surface_id_; 207 *surface_id = surface_id_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void MockRenderThread::OnDuplicateSection( 258 void MockRenderThread::OnDuplicateSection(
272 base::SharedMemoryHandle renderer_handle, 259 base::SharedMemoryHandle renderer_handle,
273 base::SharedMemoryHandle* browser_handle) { 260 base::SharedMemoryHandle* browser_handle) {
274 // We don't have to duplicate the input handles since RenderViewTest does not 261 // We don't have to duplicate the input handles since RenderViewTest does not
275 // separate a browser process from a renderer process. 262 // separate a browser process from a renderer process.
276 *browser_handle = renderer_handle; 263 *browser_handle = renderer_handle;
277 } 264 }
278 #endif // defined(OS_WIN) 265 #endif // defined(OS_WIN)
279 266
280 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_render_thread.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698