| 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 "media/video/capture/screen/screen_capture_device.h" | 5 #include "media/video/capture/screen/screen_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 19 matching lines...) Expand all Loading... |
| 30 const int kBufferSize = kTestFrameWidth2 * kTestFrameHeight2 * 4; | 30 const int kBufferSize = kTestFrameWidth2 * kTestFrameHeight2 * 4; |
| 31 | 31 |
| 32 const int kFrameRate = 30; | 32 const int kFrameRate = 30; |
| 33 | 33 |
| 34 class MockFrameObserver : public VideoCaptureDevice::EventHandler { | 34 class MockFrameObserver : public VideoCaptureDevice::EventHandler { |
| 35 public: | 35 public: |
| 36 MOCK_METHOD0(OnError, void()); | 36 MOCK_METHOD0(OnError, void()); |
| 37 MOCK_METHOD1(OnFrameInfo, void(const VideoCaptureCapability& info)); | 37 MOCK_METHOD1(OnFrameInfo, void(const VideoCaptureCapability& info)); |
| 38 MOCK_METHOD3(OnIncomingCapturedFrame, void(const uint8* data, int length, | 38 MOCK_METHOD3(OnIncomingCapturedFrame, void(const uint8* data, int length, |
| 39 base::Time timestamp)); | 39 base::Time timestamp)); |
| 40 MOCK_METHOD2(OnIncomingCapturedVideoFrame, void(media::VideoFrame* frame, |
| 41 base::Time timestamp)); |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 // TODO(sergeyu): Move this to a separate file where it can be reused. | 44 // TODO(sergeyu): Move this to a separate file where it can be reused. |
| 43 class FakeScreenCapturer : public ScreenCapturer { | 45 class FakeScreenCapturer : public ScreenCapturer { |
| 44 public: | 46 public: |
| 45 FakeScreenCapturer() | 47 FakeScreenCapturer() |
| 46 : delegate_(NULL), | 48 : delegate_(NULL), |
| 47 frame_index_(0) { | 49 frame_index_(0) { |
| 48 buffer_.reset(new uint8[kBufferSize]); | 50 buffer_.reset(new uint8[kBufferSize]); |
| 49 frames_[0] = new ScreenCaptureData( | 51 frames_[0] = new ScreenCaptureData( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 EXPECT_EQ(kTestFrameWidth1, caps.width); | 161 EXPECT_EQ(kTestFrameWidth1, caps.width); |
| 160 EXPECT_EQ(kTestFrameHeight1, caps.height); | 162 EXPECT_EQ(kTestFrameHeight1, caps.height); |
| 161 EXPECT_EQ(kFrameRate, caps.frame_rate); | 163 EXPECT_EQ(kFrameRate, caps.frame_rate); |
| 162 EXPECT_EQ(VideoCaptureCapability::kARGB, caps.color); | 164 EXPECT_EQ(VideoCaptureCapability::kARGB, caps.color); |
| 163 EXPECT_FALSE(caps.interlaced); | 165 EXPECT_FALSE(caps.interlaced); |
| 164 | 166 |
| 165 EXPECT_EQ(caps.width * caps.height * 4, frame_size); | 167 EXPECT_EQ(caps.width * caps.height * 4, frame_size); |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace media | 170 } // namespace media |
| OLD | NEW |