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

Side by Side Diff: content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc

Issue 103633002: Add RenderFrameHostDelegate and plumb it through all the necessary classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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
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/browser/renderer_host/media/web_contents_video_capture_device. h" 5 #include "content/browser/renderer_host/media/web_contents_video_capture_device. h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/debug/debugger.h" 8 #include "base/debug/debugger.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 #pragma warning(disable: 4250) 221 #pragma warning(disable: 4250)
222 #endif 222 #endif
223 223
224 // A stub implementation which returns solid-color bitmaps in calls to 224 // A stub implementation which returns solid-color bitmaps in calls to
225 // CopyFromBackingStore(). The behavior is controlled by a 225 // CopyFromBackingStore(). The behavior is controlled by a
226 // CaptureTestSourceController. 226 // CaptureTestSourceController.
227 class CaptureTestRenderViewHost : public TestRenderViewHost { 227 class CaptureTestRenderViewHost : public TestRenderViewHost {
228 public: 228 public:
229 CaptureTestRenderViewHost(SiteInstance* instance, 229 CaptureTestRenderViewHost(SiteInstance* instance,
230 RenderViewHostDelegate* delegate, 230 RenderViewHostDelegate* delegate,
231 RenderFrameHostDelegate* frame_delegate,
231 RenderWidgetHostDelegate* widget_delegate, 232 RenderWidgetHostDelegate* widget_delegate,
232 int routing_id, 233 int routing_id,
233 int main_frame_routing_id, 234 int main_frame_routing_id,
234 bool swapped_out, 235 bool swapped_out,
235 CaptureTestSourceController* controller) 236 CaptureTestSourceController* controller)
236 : TestRenderViewHost(instance, delegate, widget_delegate, routing_id, 237 : TestRenderViewHost(instance, delegate, frame_delegate, widget_delegate,
237 main_frame_routing_id, swapped_out), 238 routing_id, main_frame_routing_id, swapped_out),
238 controller_(controller) { 239 controller_(controller) {
239 // Override the default view installed by TestRenderViewHost; we need 240 // Override the default view installed by TestRenderViewHost; we need
240 // our special subclass which has mocked-out tab capture support. 241 // our special subclass which has mocked-out tab capture support.
241 RenderWidgetHostView* old_view = GetView(); 242 RenderWidgetHostView* old_view = GetView();
242 SetView(new CaptureTestView(this, controller)); 243 SetView(new CaptureTestView(this, controller));
243 delete old_view; 244 delete old_view;
244 } 245 }
245 246
246 // TestRenderViewHost overrides. 247 // TestRenderViewHost overrides.
247 virtual void CopyFromBackingStore( 248 virtual void CopyFromBackingStore(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 283 }
283 284
284 virtual ~CaptureTestRenderViewHostFactory() { 285 virtual ~CaptureTestRenderViewHostFactory() {
285 UnregisterFactory(); 286 UnregisterFactory();
286 } 287 }
287 288
288 // RenderViewHostFactory implementation. 289 // RenderViewHostFactory implementation.
289 virtual RenderViewHost* CreateRenderViewHost( 290 virtual RenderViewHost* CreateRenderViewHost(
290 SiteInstance* instance, 291 SiteInstance* instance,
291 RenderViewHostDelegate* delegate, 292 RenderViewHostDelegate* delegate,
293 RenderFrameHostDelegate* frame_delegate,
292 RenderWidgetHostDelegate* widget_delegate, 294 RenderWidgetHostDelegate* widget_delegate,
293 int routing_id, 295 int routing_id,
294 int main_frame_routing_id, 296 int main_frame_routing_id,
295 bool swapped_out) OVERRIDE { 297 bool swapped_out) OVERRIDE {
296 return new CaptureTestRenderViewHost(instance, delegate, widget_delegate, 298 return new CaptureTestRenderViewHost(instance, delegate, frame_delegate,
297 routing_id, main_frame_routing_id, 299 widget_delegate, routing_id,
298 swapped_out, controller_); 300 main_frame_routing_id, swapped_out,
301 controller_);
299 } 302 }
300 private: 303 private:
301 CaptureTestSourceController* controller_; 304 CaptureTestSourceController* controller_;
302 305
303 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); 306 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory);
304 }; 307 };
305 308
306 // A stub consumer of captured video frames, which checks the output of 309 // A stub consumer of captured video frames, which checks the output of
307 // WebContentsVideoCaptureDevice. 310 // WebContentsVideoCaptureDevice.
308 class StubClient : public media::VideoCaptureDevice::Client { 311 class StubClient : public media::VideoCaptureDevice::Client {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 source()->SetSolidColor(SK_ColorGREEN); 811 source()->SetSolidColor(SK_ColorGREEN);
809 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 812 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
810 source()->SetSolidColor(SK_ColorRED); 813 source()->SetSolidColor(SK_ColorRED);
811 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); 814 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED));
812 815
813 device()->StopAndDeAllocate(); 816 device()->StopAndDeAllocate();
814 } 817 }
815 818
816 } // namespace 819 } // namespace
817 } // namespace content 820 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/test_render_frame_host.cc ('k') | content/browser/renderer_host/render_view_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698