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/renderer_host/media/desktop_capture_device.h" | 5 #include "content/browser/renderer_host/media/desktop_capture_device.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 const int kTestFrameWidth1 = 100; | 34 const int kTestFrameWidth1 = 100; |
35 const int kTestFrameHeight1 = 100; | 35 const int kTestFrameHeight1 = 100; |
36 const int kTestFrameWidth2 = 200; | 36 const int kTestFrameWidth2 = 200; |
37 const int kTestFrameHeight2 = 150; | 37 const int kTestFrameHeight2 = 150; |
38 | 38 |
39 const int kFrameRate = 30; | 39 const int kFrameRate = 30; |
40 | 40 |
41 class MockDeviceClient : public media::VideoCaptureDevice::Client { | 41 class MockDeviceClient : public media::VideoCaptureDevice::Client { |
42 public: | 42 public: |
43 MOCK_METHOD1(ReserveOutputBuffer, | 43 MOCK_METHOD2(ReserveOutputBuffer, |
44 scoped_refptr<media::VideoFrame>(const gfx::Size& size)); | 44 scoped_refptr<Buffer>(media::VideoFrame::Format format, |
| 45 const gfx::Size& dimensions)); |
45 MOCK_METHOD0(OnError, void()); | 46 MOCK_METHOD0(OnError, void()); |
46 MOCK_METHOD1(OnFrameInfo, void(const media::VideoCaptureCapability& info)); | 47 MOCK_METHOD1(OnFrameInfo, void(const media::VideoCaptureCapability& info)); |
47 MOCK_METHOD1(OnFrameInfoChanged, | 48 MOCK_METHOD1(OnFrameInfoChanged, |
48 void(const media::VideoCaptureCapability& info)); | 49 void(const media::VideoCaptureCapability& info)); |
49 MOCK_METHOD6(OnIncomingCapturedFrame, void(const uint8* data, | 50 MOCK_METHOD6(OnIncomingCapturedFrame, void(const uint8* data, |
50 int length, | 51 int length, |
51 base::Time timestamp, | 52 base::Time timestamp, |
52 int rotation, | 53 int rotation, |
53 bool flip_vert, | 54 bool flip_vert, |
54 bool flip_horiz)); | 55 bool flip_horiz)); |
55 MOCK_METHOD2(OnIncomingCapturedVideoFrame, | 56 MOCK_METHOD4(OnIncomingCapturedBuffer, |
56 void(const scoped_refptr<media::VideoFrame>& frame, | 57 void(const scoped_refptr<Buffer>& buffer, |
57 base::Time timestamp)); | 58 media::VideoFrame::Format format, |
| 59 const gfx::Size& dimensions, |
| 60 base::Time timestamp)); |
58 }; | 61 }; |
59 | 62 |
60 // TODO(sergeyu): Move this to a separate file where it can be reused. | 63 // TODO(sergeyu): Move this to a separate file where it can be reused. |
61 class FakeScreenCapturer : public webrtc::ScreenCapturer { | 64 class FakeScreenCapturer : public webrtc::ScreenCapturer { |
62 public: | 65 public: |
63 FakeScreenCapturer() | 66 FakeScreenCapturer() |
64 : callback_(NULL), | 67 : callback_(NULL), |
65 frame_index_(0) { | 68 frame_index_(0) { |
66 } | 69 } |
67 virtual ~FakeScreenCapturer() {} | 70 virtual ~FakeScreenCapturer() {} |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 capture_device.StopAndDeAllocate(); | 252 capture_device.StopAndDeAllocate(); |
250 | 253 |
251 EXPECT_EQ(kTestFrameWidth1, caps.width); | 254 EXPECT_EQ(kTestFrameWidth1, caps.width); |
252 EXPECT_EQ(kTestFrameHeight1, caps.height); | 255 EXPECT_EQ(kTestFrameHeight1, caps.height); |
253 EXPECT_EQ(kFrameRate, caps.frame_rate); | 256 EXPECT_EQ(kFrameRate, caps.frame_rate); |
254 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, caps.color); | 257 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, caps.color); |
255 worker_pool_->FlushForTesting(); | 258 worker_pool_->FlushForTesting(); |
256 } | 259 } |
257 | 260 |
258 } // namespace content | 261 } // namespace content |
OLD | NEW |