| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 MOCK_METHOD9(OnIncomingCapturedYuvData, | 62 MOCK_METHOD9(OnIncomingCapturedYuvData, |
| 63 void (const uint8* y_data, | 63 void (const uint8* y_data, |
| 64 const uint8* u_data, | 64 const uint8* u_data, |
| 65 const uint8* v_data, | 65 const uint8* v_data, |
| 66 size_t y_stride, | 66 size_t y_stride, |
| 67 size_t u_stride, | 67 size_t u_stride, |
| 68 size_t v_stride, | 68 size_t v_stride, |
| 69 const media::VideoCaptureFormat& frame_format, | 69 const media::VideoCaptureFormat& frame_format, |
| 70 int clockwise_rotation, | 70 int clockwise_rotation, |
| 71 const base::TimeTicks& timestamp)); | 71 const base::TimeTicks& timestamp)); |
| 72 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 72 MOCK_METHOD2(ReserveOutputBuffer, |
| 73 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 73 scoped_refptr<Buffer>(media::VideoPixelFormat format, |
| 74 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 74 const gfx::Size& dimensions)); |
| 75 MOCK_METHOD3(OnIncomingCapturedVideoFrame, |
| 76 void(const scoped_refptr<Buffer>& buffer, |
| 77 const scoped_refptr<media::VideoFrame>& frame, |
| 78 const base::TimeTicks& timestamp)); |
| 75 MOCK_METHOD1(OnError, void(const std::string& reason)); | 79 MOCK_METHOD1(OnError, void(const std::string& reason)); |
| 76 | |
| 77 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. | |
| 78 scoped_ptr<Buffer> ReserveOutputBuffer(media::VideoPixelFormat format, | |
| 79 const gfx::Size& dimensions) override { | |
| 80 DoReserveOutputBuffer(); | |
| 81 return scoped_ptr<Buffer>(); | |
| 82 } | |
| 83 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | |
| 84 const media::VideoCaptureFormat& frame_format, | |
| 85 const base::TimeTicks& timestamp) override { | |
| 86 DoOnIncomingCapturedBuffer(); | |
| 87 } | |
| 88 void OnIncomingCapturedVideoFrame( | |
| 89 scoped_ptr<Buffer> buffer, | |
| 90 const scoped_refptr<media::VideoFrame>& frame, | |
| 91 const base::TimeTicks& timestamp) override { | |
| 92 DoOnIncomingCapturedVideoFrame(); | |
| 93 } | |
| 94 }; | 80 }; |
| 95 | 81 |
| 96 // Creates a DesktopFrame that has the first pixel bytes set to | 82 // Creates a DesktopFrame that has the first pixel bytes set to |
| 97 // kFakePixelValueFirst, and the rest of the bytes set to kFakePixelValue, for | 83 // kFakePixelValueFirst, and the rest of the bytes set to kFakePixelValue, for |
| 98 // UnpackedFrame and InvertedFrame verification. | 84 // UnpackedFrame and InvertedFrame verification. |
| 99 webrtc::BasicDesktopFrame* CreateBasicFrame(const webrtc::DesktopSize& size) { | 85 webrtc::BasicDesktopFrame* CreateBasicFrame(const webrtc::DesktopSize& size) { |
| 100 webrtc::BasicDesktopFrame* frame = new webrtc::BasicDesktopFrame(size);; | 86 webrtc::BasicDesktopFrame* frame = new webrtc::BasicDesktopFrame(size);; |
| 101 DCHECK_EQ(frame->size().width() * webrtc::DesktopFrame::kBytesPerPixel, | 87 DCHECK_EQ(frame->size().width() * webrtc::DesktopFrame::kBytesPerPixel, |
| 102 frame->stride()); | 88 frame->stride()); |
| 103 memset(frame->data(), | 89 memset(frame->data(), |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 frame_size); | 422 frame_size); |
| 437 for (int i = 0; i < output_frame_->size().height(); ++i) { | 423 for (int i = 0; i < output_frame_->size().height(); ++i) { |
| 438 EXPECT_EQ(0, | 424 EXPECT_EQ(0, |
| 439 memcmp(inverted_frame->data() + i * inverted_frame->stride(), | 425 memcmp(inverted_frame->data() + i * inverted_frame->stride(), |
| 440 output_frame_->data() + i * output_frame_->stride(), | 426 output_frame_->data() + i * output_frame_->stride(), |
| 441 output_frame_->stride())); | 427 output_frame_->stride())); |
| 442 } | 428 } |
| 443 } | 429 } |
| 444 | 430 |
| 445 } // namespace content | 431 } // namespace content |
| OLD | NEW |