| 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/renderer_host/media/desktop_capture_device_aura.h" | 5 #include "content/browser/renderer_host/media/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/video/capture/video_capture_types.h" | 10 #include "media/video/capture/video_capture_types.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/aura/client/window_tree_client.h" | 13 #include "ui/aura/client/window_tree_client.h" |
| 14 #include "ui/aura/test/aura_test_helper.h" | 14 #include "ui/aura/test/aura_test_helper.h" |
| 15 #include "ui/aura/test/test_window_delegate.h" | 15 #include "ui/aura/test/test_window_delegate.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 | 17 |
| 18 using ::testing::_; | 18 using ::testing::_; |
| 19 using ::testing::AnyNumber; | 19 using ::testing::AnyNumber; |
| 20 using ::testing::DoAll; | 20 using ::testing::DoAll; |
| 21 using ::testing::Expectation; | 21 using ::testing::Expectation; |
| 22 using ::testing::InvokeWithoutArgs; | 22 using ::testing::InvokeWithoutArgs; |
| 23 using ::testing::SaveArg; | 23 using ::testing::SaveArg; |
| 24 | 24 |
| 25 namespace media { |
| 26 class VideoFrame; |
| 27 } // namespace media |
| 28 |
| 25 namespace content { | 29 namespace content { |
| 26 namespace { | 30 namespace { |
| 27 | 31 |
| 28 const int kFrameRate = 30; | 32 const int kFrameRate = 30; |
| 29 | 33 |
| 30 class MockDeviceClient : public media::VideoCaptureDevice::Client { | 34 class MockDeviceClient : public media::VideoCaptureDevice::Client { |
| 31 public: | 35 public: |
| 32 MOCK_METHOD2(ReserveOutputBuffer, | 36 MOCK_METHOD2(ReserveOutputBuffer, |
| 33 scoped_refptr<Buffer>(media::VideoFrame::Format format, | 37 scoped_refptr<Buffer>(media::VideoFrame::Format format, |
| 34 const gfx::Size& dimensions)); | 38 const gfx::Size& dimensions)); |
| 35 MOCK_METHOD1(OnError, void(const std::string& reason)); | 39 MOCK_METHOD1(OnError, void(const std::string& reason)); |
| 36 MOCK_METHOD5(OnIncomingCapturedFrame, | 40 MOCK_METHOD5(OnIncomingCapturedData, |
| 37 void(const uint8* data, | 41 void(const uint8* data, |
| 38 int length, | 42 int length, |
| 39 base::TimeTicks timestamp, | 43 const media::VideoCaptureFormat& frame_format, |
| 40 int rotation, | 44 int rotation, |
| 41 const media::VideoCaptureFormat& frame_format)); | 45 base::TimeTicks timestamp)); |
| 42 MOCK_METHOD5(OnIncomingCapturedBuffer, | 46 MOCK_METHOD4(OnIncomingCapturedVideoFrame, |
| 43 void(const scoped_refptr<Buffer>& buffer, | 47 void(const scoped_refptr<Buffer>& buffer, |
| 44 media::VideoFrame::Format format, | 48 const media::VideoCaptureFormat& buffer_format, |
| 45 const gfx::Size& dimensions, | 49 const scoped_refptr<media::VideoFrame>& frame, |
| 46 base::TimeTicks timestamp, | 50 base::TimeTicks timestamp)); |
| 47 int frame_rate)); | |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 // Test harness that sets up a minimal environment with necessary stubs. | 53 // Test harness that sets up a minimal environment with necessary stubs. |
| 51 class DesktopCaptureDeviceAuraTest : public testing::Test { | 54 class DesktopCaptureDeviceAuraTest : public testing::Test { |
| 52 public: | 55 public: |
| 53 DesktopCaptureDeviceAuraTest() | 56 DesktopCaptureDeviceAuraTest() |
| 54 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} | 57 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} |
| 55 virtual ~DesktopCaptureDeviceAuraTest() {} | 58 virtual ~DesktopCaptureDeviceAuraTest() {} |
| 56 | 59 |
| 57 protected: | 60 protected: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 capture_params.requested_format.frame_rate = kFrameRate; | 109 capture_params.requested_format.frame_rate = kFrameRate; |
| 107 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 110 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 108 capture_params.allow_resolution_change = false; | 111 capture_params.allow_resolution_change = false; |
| 109 capture_device->AllocateAndStart( | 112 capture_device->AllocateAndStart( |
| 110 capture_params, client.PassAs<media::VideoCaptureDevice::Client>()); | 113 capture_params, client.PassAs<media::VideoCaptureDevice::Client>()); |
| 111 capture_device->StopAndDeAllocate(); | 114 capture_device->StopAndDeAllocate(); |
| 112 } | 115 } |
| 113 | 116 |
| 114 } // namespace | 117 } // namespace |
| 115 } // namespace content | 118 } // namespace content |
| OLD | NEW |