| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
| 9 #include "content/public/browser/desktop_media_id.h" | 9 #include "content/public/browser/desktop_media_id.h" |
| 10 #include "media/base/video_capture_types.h" | 10 #include "media/base/video_capture_types.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 MOCK_METHOD9(OnIncomingCapturedYuvData, | 44 MOCK_METHOD9(OnIncomingCapturedYuvData, |
| 45 void (const uint8* y_data, | 45 void (const uint8* y_data, |
| 46 const uint8* u_data, | 46 const uint8* u_data, |
| 47 const uint8* v_data, | 47 const uint8* v_data, |
| 48 size_t y_stride, | 48 size_t y_stride, |
| 49 size_t u_stride, | 49 size_t u_stride, |
| 50 size_t v_stride, | 50 size_t v_stride, |
| 51 const media::VideoCaptureFormat& frame_format, | 51 const media::VideoCaptureFormat& frame_format, |
| 52 int clockwise_rotation, | 52 int clockwise_rotation, |
| 53 const base::TimeTicks& timestamp)); | 53 const base::TimeTicks& timestamp)); |
| 54 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 54 MOCK_METHOD2(ReserveOutputBuffer, |
| 55 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 55 scoped_refptr<Buffer>(media::VideoPixelFormat format, |
| 56 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 56 const gfx::Size& dimensions)); |
| 57 MOCK_METHOD3(OnIncomingCapturedVideoFrame, |
| 58 void(const scoped_refptr<Buffer>& buffer, |
| 59 const scoped_refptr<media::VideoFrame>& frame, |
| 60 const base::TimeTicks& timestamp)); |
| 57 MOCK_METHOD1(OnError, void(const std::string& reason)); | 61 MOCK_METHOD1(OnError, void(const std::string& reason)); |
| 58 | |
| 59 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. | |
| 60 scoped_ptr<Buffer> ReserveOutputBuffer(media::VideoPixelFormat format, | |
| 61 const gfx::Size& dimensions) override { | |
| 62 DoReserveOutputBuffer(); | |
| 63 return scoped_ptr<Buffer>(); | |
| 64 } | |
| 65 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | |
| 66 const media::VideoCaptureFormat& frame_format, | |
| 67 const base::TimeTicks& timestamp) override { | |
| 68 DoOnIncomingCapturedBuffer(); | |
| 69 } | |
| 70 void OnIncomingCapturedVideoFrame( | |
| 71 scoped_ptr<Buffer> buffer, | |
| 72 const scoped_refptr<media::VideoFrame>& frame, | |
| 73 const base::TimeTicks& timestamp) override { | |
| 74 DoOnIncomingCapturedVideoFrame(); | |
| 75 } | |
| 76 }; | 62 }; |
| 77 | 63 |
| 78 // Test harness that sets up a minimal environment with necessary stubs. | 64 // Test harness that sets up a minimal environment with necessary stubs. |
| 79 class DesktopCaptureDeviceAuraTest : public testing::Test { | 65 class DesktopCaptureDeviceAuraTest : public testing::Test { |
| 80 public: | 66 public: |
| 81 DesktopCaptureDeviceAuraTest() | 67 DesktopCaptureDeviceAuraTest() |
| 82 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} | 68 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} |
| 83 ~DesktopCaptureDeviceAuraTest() override {} | 69 ~DesktopCaptureDeviceAuraTest() override {} |
| 84 | 70 |
| 85 protected: | 71 protected: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 media::VideoCaptureParams capture_params; | 123 media::VideoCaptureParams capture_params; |
| 138 capture_params.requested_format.frame_size.SetSize(640, 480); | 124 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 139 capture_params.requested_format.frame_rate = kFrameRate; | 125 capture_params.requested_format.frame_rate = kFrameRate; |
| 140 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 126 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 141 capture_device->AllocateAndStart(capture_params, client.Pass()); | 127 capture_device->AllocateAndStart(capture_params, client.Pass()); |
| 142 capture_device->StopAndDeAllocate(); | 128 capture_device->StopAndDeAllocate(); |
| 143 } | 129 } |
| 144 | 130 |
| 145 } // namespace | 131 } // namespace |
| 146 } // namespace content | 132 } // namespace content |
| OLD | NEW |