| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 int frame_feedback_id)); | 51 int frame_feedback_id)); |
| 52 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 52 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); |
| 53 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 53 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); |
| 54 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 54 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); |
| 55 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void)); | 55 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void)); |
| 56 MOCK_METHOD2(OnError, | 56 MOCK_METHOD2(OnError, |
| 57 void(const tracked_objects::Location& from_here, | 57 void(const tracked_objects::Location& from_here, |
| 58 const std::string& reason)); | 58 const std::string& reason)); |
| 59 | 59 |
| 60 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. | 60 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. |
| 61 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions, | 61 Buffer ReserveOutputBuffer(const gfx::Size& dimensions, |
| 62 media::VideoPixelFormat format, | 62 media::VideoPixelFormat format, |
| 63 media::VideoPixelStorage storage, | 63 media::VideoPixelStorage storage, |
| 64 int frame_feedback_id) override { | 64 int frame_feedback_id) override { |
| 65 EXPECT_EQ(media::PIXEL_FORMAT_I420, format); | 65 EXPECT_EQ(media::PIXEL_FORMAT_I420, format); |
| 66 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage); | 66 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage); |
| 67 DoReserveOutputBuffer(); | 67 DoReserveOutputBuffer(); |
| 68 return std::unique_ptr<Buffer>(); | 68 return Buffer(); |
| 69 } | 69 } |
| 70 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 70 void OnIncomingCapturedBuffer(Buffer buffer, |
| 71 const media::VideoCaptureFormat& frame_format, | 71 const media::VideoCaptureFormat& frame_format, |
| 72 base::TimeTicks reference_time, | 72 base::TimeTicks reference_time, |
| 73 base::TimeDelta timestamp) override { | 73 base::TimeDelta timestamp) override { |
| 74 DoOnIncomingCapturedBuffer(); | 74 DoOnIncomingCapturedBuffer(); |
| 75 } | 75 } |
| 76 void OnIncomingCapturedBufferExt( | 76 void OnIncomingCapturedBufferExt( |
| 77 std::unique_ptr<Buffer> buffer, | 77 Buffer buffer, |
| 78 const media::VideoCaptureFormat& format, | 78 const media::VideoCaptureFormat& format, |
| 79 base::TimeTicks reference_time, | 79 base::TimeTicks reference_time, |
| 80 base::TimeDelta timestamp, | 80 base::TimeDelta timestamp, |
| 81 gfx::Rect visible_rect, | 81 gfx::Rect visible_rect, |
| 82 const media::VideoFrameMetadata& additional_metadata) override { | 82 const media::VideoFrameMetadata& additional_metadata) override { |
| 83 DoOnIncomingCapturedVideoFrame(); | 83 DoOnIncomingCapturedVideoFrame(); |
| 84 } | 84 } |
| 85 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 85 Buffer ResurrectLastOutputBuffer(const gfx::Size& dimensions, |
| 86 const gfx::Size& dimensions, | 86 media::VideoPixelFormat format, |
| 87 media::VideoPixelFormat format, | 87 media::VideoPixelStorage storage, |
| 88 media::VideoPixelStorage storage, | 88 int frame_feedback_id) override { |
| 89 int frame_feedback_id) override { | |
| 90 EXPECT_EQ(media::PIXEL_FORMAT_I420, format); | 89 EXPECT_EQ(media::PIXEL_FORMAT_I420, format); |
| 91 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage); | 90 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage); |
| 92 DoResurrectLastOutputBuffer(); | 91 DoResurrectLastOutputBuffer(); |
| 93 return std::unique_ptr<Buffer>(); | 92 return Buffer(); |
| 94 } | 93 } |
| 95 double GetBufferPoolUtilization() const override { return 0.0; } | 94 double GetBufferPoolUtilization() const override { return 0.0; } |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 // Test harness that sets up a minimal environment with necessary stubs. | 97 // Test harness that sets up a minimal environment with necessary stubs. |
| 99 class DesktopCaptureDeviceAuraTest : public testing::Test { | 98 class DesktopCaptureDeviceAuraTest : public testing::Test { |
| 100 public: | 99 public: |
| 101 DesktopCaptureDeviceAuraTest() = default; | 100 DesktopCaptureDeviceAuraTest() = default; |
| 102 ~DesktopCaptureDeviceAuraTest() override = default; | 101 ~DesktopCaptureDeviceAuraTest() override = default; |
| 103 | 102 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 media::VideoCaptureParams capture_params; | 159 media::VideoCaptureParams capture_params; |
| 161 capture_params.requested_format.frame_size.SetSize(640, 480); | 160 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 162 capture_params.requested_format.frame_rate = kFrameRate; | 161 capture_params.requested_format.frame_rate = kFrameRate; |
| 163 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 162 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 164 capture_device->AllocateAndStart(capture_params, std::move(client)); | 163 capture_device->AllocateAndStart(capture_params, std::move(client)); |
| 165 capture_device->StopAndDeAllocate(); | 164 capture_device->StopAndDeAllocate(); |
| 166 } | 165 } |
| 167 | 166 |
| 168 } // namespace | 167 } // namespace |
| 169 } // namespace content | 168 } // namespace content |
| OLD | NEW |