| 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/media/capture/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 // A stub implementation which returns solid-color bitmaps in calls to | 242 // A stub implementation which returns solid-color bitmaps in calls to |
| 243 // CopyFromBackingStore(). The behavior is controlled by a | 243 // CopyFromBackingStore(). The behavior is controlled by a |
| 244 // CaptureTestSourceController. | 244 // CaptureTestSourceController. |
| 245 class CaptureTestRenderViewHost : public TestRenderViewHost { | 245 class CaptureTestRenderViewHost : public TestRenderViewHost { |
| 246 public: | 246 public: |
| 247 CaptureTestRenderViewHost(SiteInstance* instance, | 247 CaptureTestRenderViewHost(SiteInstance* instance, |
| 248 RenderViewHostDelegate* delegate, | 248 RenderViewHostDelegate* delegate, |
| 249 RenderWidgetHostDelegate* widget_delegate, | 249 RenderWidgetHostDelegate* widget_delegate, |
| 250 int32 routing_id, | 250 int32 routing_id, |
| 251 int32 surface_id, | |
| 252 int32 main_frame_routing_id, | 251 int32 main_frame_routing_id, |
| 253 bool swapped_out, | 252 bool swapped_out, |
| 254 CaptureTestSourceController* controller) | 253 CaptureTestSourceController* controller) |
| 255 : TestRenderViewHost(instance, | 254 : TestRenderViewHost(instance, |
| 256 delegate, | 255 delegate, |
| 257 widget_delegate, | 256 widget_delegate, |
| 258 routing_id, | 257 routing_id, |
| 259 surface_id, | |
| 260 main_frame_routing_id, | 258 main_frame_routing_id, |
| 261 swapped_out), | 259 swapped_out), |
| 262 controller_(controller) { | 260 controller_(controller) { |
| 263 // Override the default view installed by TestRenderViewHost; we need | 261 // Override the default view installed by TestRenderViewHost; we need |
| 264 // our special subclass which has mocked-out tab capture support. | 262 // our special subclass which has mocked-out tab capture support. |
| 265 RenderWidgetHostView* old_view = GetView(); | 263 RenderWidgetHostView* old_view = GetView(); |
| 266 SetView(new CaptureTestView(this, controller)); | 264 SetView(new CaptureTestView(this, controller)); |
| 267 delete old_view; | 265 delete old_view; |
| 268 } | 266 } |
| 269 | 267 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 304 } |
| 307 | 305 |
| 308 ~CaptureTestRenderViewHostFactory() override { UnregisterFactory(); } | 306 ~CaptureTestRenderViewHostFactory() override { UnregisterFactory(); } |
| 309 | 307 |
| 310 // RenderViewHostFactory implementation. | 308 // RenderViewHostFactory implementation. |
| 311 RenderViewHost* CreateRenderViewHost( | 309 RenderViewHost* CreateRenderViewHost( |
| 312 SiteInstance* instance, | 310 SiteInstance* instance, |
| 313 RenderViewHostDelegate* delegate, | 311 RenderViewHostDelegate* delegate, |
| 314 RenderWidgetHostDelegate* widget_delegate, | 312 RenderWidgetHostDelegate* widget_delegate, |
| 315 int32 routing_id, | 313 int32 routing_id, |
| 316 int32 surface_id, | |
| 317 int32 main_frame_routing_id, | 314 int32 main_frame_routing_id, |
| 318 bool swapped_out) override { | 315 bool swapped_out) override { |
| 319 return new CaptureTestRenderViewHost( | 316 return new CaptureTestRenderViewHost(instance, delegate, widget_delegate, |
| 320 instance, delegate, widget_delegate, routing_id, surface_id, | 317 routing_id, main_frame_routing_id, |
| 321 main_frame_routing_id, swapped_out, controller_); | 318 swapped_out, controller_); |
| 322 } | 319 } |
| 323 private: | 320 private: |
| 324 CaptureTestSourceController* controller_; | 321 CaptureTestSourceController* controller_; |
| 325 | 322 |
| 326 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); | 323 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); |
| 327 }; | 324 }; |
| 328 | 325 |
| 329 // A stub consumer of captured video frames, which checks the output of | 326 // A stub consumer of captured video frames, which checks the output of |
| 330 // WebContentsVideoCaptureDevice. | 327 // WebContentsVideoCaptureDevice. |
| 331 class StubClient : public media::VideoCaptureDevice::Client { | 328 class StubClient : public media::VideoCaptureDevice::Client { |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); | 1132 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); |
| 1136 RunTestForPreferredSize( | 1133 RunTestForPreferredSize( |
| 1137 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); | 1134 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); |
| 1138 RunTestForPreferredSize( | 1135 RunTestForPreferredSize( |
| 1139 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); | 1136 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); |
| 1140 } | 1137 } |
| 1141 } | 1138 } |
| 1142 | 1139 |
| 1143 } // namespace | 1140 } // namespace |
| 1144 } // namespace content | 1141 } // namespace content |
| OLD | NEW |