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 #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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 // A stub implementation which returns solid-color bitmaps in calls to | 221 // A stub implementation which returns solid-color bitmaps in calls to |
222 // CopyFromBackingStore(). The behavior is controlled by a | 222 // CopyFromBackingStore(). The behavior is controlled by a |
223 // CaptureTestSourceController. | 223 // CaptureTestSourceController. |
224 class CaptureTestRenderViewHost : public TestRenderViewHost { | 224 class CaptureTestRenderViewHost : public TestRenderViewHost { |
225 public: | 225 public: |
226 CaptureTestRenderViewHost(SiteInstance* instance, | 226 CaptureTestRenderViewHost(SiteInstance* instance, |
227 RenderViewHostDelegate* delegate, | 227 RenderViewHostDelegate* delegate, |
228 RenderWidgetHostDelegate* widget_delegate, | 228 RenderWidgetHostDelegate* widget_delegate, |
229 int routing_id, | 229 int routing_id, |
| 230 int main_frame_routing_id, |
230 bool swapped_out, | 231 bool swapped_out, |
231 CaptureTestSourceController* controller) | 232 CaptureTestSourceController* controller) |
232 : TestRenderViewHost(instance, delegate, widget_delegate, routing_id, | 233 : TestRenderViewHost(instance, delegate, widget_delegate, routing_id, |
233 swapped_out), | 234 main_frame_routing_id, swapped_out), |
234 controller_(controller) { | 235 controller_(controller) { |
235 // Override the default view installed by TestRenderViewHost; we need | 236 // Override the default view installed by TestRenderViewHost; we need |
236 // our special subclass which has mocked-out tab capture support. | 237 // our special subclass which has mocked-out tab capture support. |
237 RenderWidgetHostView* old_view = GetView(); | 238 RenderWidgetHostView* old_view = GetView(); |
238 SetView(new CaptureTestView(this, controller)); | 239 SetView(new CaptureTestView(this, controller)); |
239 delete old_view; | 240 delete old_view; |
240 } | 241 } |
241 | 242 |
242 // TestRenderViewHost overrides. | 243 // TestRenderViewHost overrides. |
243 virtual void CopyFromBackingStore( | 244 virtual void CopyFromBackingStore( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 virtual ~CaptureTestRenderViewHostFactory() { | 281 virtual ~CaptureTestRenderViewHostFactory() { |
281 UnregisterFactory(); | 282 UnregisterFactory(); |
282 } | 283 } |
283 | 284 |
284 // RenderViewHostFactory implementation. | 285 // RenderViewHostFactory implementation. |
285 virtual RenderViewHost* CreateRenderViewHost( | 286 virtual RenderViewHost* CreateRenderViewHost( |
286 SiteInstance* instance, | 287 SiteInstance* instance, |
287 RenderViewHostDelegate* delegate, | 288 RenderViewHostDelegate* delegate, |
288 RenderWidgetHostDelegate* widget_delegate, | 289 RenderWidgetHostDelegate* widget_delegate, |
289 int routing_id, | 290 int routing_id, |
| 291 int main_frame_routing_id, |
290 bool swapped_out, | 292 bool swapped_out, |
291 SessionStorageNamespace* session_storage_namespace) OVERRIDE { | 293 SessionStorageNamespace* session_storage_namespace) OVERRIDE { |
292 return new CaptureTestRenderViewHost(instance, delegate, widget_delegate, | 294 return new CaptureTestRenderViewHost(instance, delegate, widget_delegate, |
293 routing_id, swapped_out, controller_); | 295 routing_id, main_frame_routing_id, |
| 296 swapped_out, controller_); |
294 } | 297 } |
295 private: | 298 private: |
296 CaptureTestSourceController* controller_; | 299 CaptureTestSourceController* controller_; |
297 | 300 |
298 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); | 301 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); |
299 }; | 302 }; |
300 | 303 |
301 // A stub consumer of captured video frames, which checks the output of | 304 // A stub consumer of captured video frames, which checks the output of |
302 // WebContentsVideoCaptureDevice. | 305 // WebContentsVideoCaptureDevice. |
303 class StubConsumer : public media::VideoCaptureDevice::EventHandler { | 306 class StubConsumer : public media::VideoCaptureDevice::EventHandler { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); | 722 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); |
720 source()->SetSolidColor(SK_ColorRED); | 723 source()->SetSolidColor(SK_ColorRED); |
721 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); | 724 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); |
722 | 725 |
723 device()->Stop(); | 726 device()->Stop(); |
724 device()->DeAllocate(); | 727 device()->DeAllocate(); |
725 } | 728 } |
726 | 729 |
727 } // namespace | 730 } // namespace |
728 } // namespace content | 731 } // namespace content |
OLD | NEW |