| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "content/renderer/media/capture_video_decoder.h" | 6 #include "content/renderer/media/capture_video_decoder.h" |
| 7 #include "content/renderer/media/video_capture_impl.h" | 7 #include "content/renderer/media/video_capture_impl.h" |
| 8 #include "content/renderer/media/video_capture_impl_manager.h" | 8 #include "content/renderer/media/video_capture_impl_manager.h" |
| 9 #include "media/base/filters.h" | 9 #include "media/base/filters.h" |
| 10 #include "media/base/limits.h" | 10 #include "media/base/limits.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 decoder->OnStopped(vc_impl); | 45 decoder->OnStopped(vc_impl); |
| 46 } | 46 } |
| 47 | 47 |
| 48 class MockVideoCaptureImpl : public VideoCaptureImpl { | 48 class MockVideoCaptureImpl : public VideoCaptureImpl { |
| 49 public: | 49 public: |
| 50 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, | 50 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, |
| 51 scoped_refptr<base::MessageLoopProxy> ml_proxy, | 51 scoped_refptr<base::MessageLoopProxy> ml_proxy, |
| 52 VideoCaptureMessageFilter* filter) | 52 VideoCaptureMessageFilter* filter) |
| 53 : VideoCaptureImpl(id, ml_proxy, filter) { | 53 : VideoCaptureImpl(id, ml_proxy, filter) { |
| 54 } | 54 } |
| 55 virtual ~MockVideoCaptureImpl() {} | |
| 56 | 55 |
| 57 MOCK_METHOD2(StartCapture, | 56 MOCK_METHOD2(StartCapture, |
| 58 void(media::VideoCapture::EventHandler* handler, | 57 void(media::VideoCapture::EventHandler* handler, |
| 59 const media::VideoCaptureCapability& capability)); | 58 const media::VideoCaptureCapability& capability)); |
| 60 MOCK_METHOD1(StopCapture, void(media::VideoCapture::EventHandler* handler)); | 59 MOCK_METHOD1(StopCapture, void(media::VideoCapture::EventHandler* handler)); |
| 61 MOCK_METHOD1(FeedBuffer, void(scoped_refptr<VideoFrameBuffer> buffer)); | 60 MOCK_METHOD1(FeedBuffer, void(scoped_refptr<VideoFrameBuffer> buffer)); |
| 62 | 61 |
| 63 private: | 62 private: |
| 64 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureImpl); | 63 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureImpl); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 class MockVideoCaptureImplManager : public VideoCaptureImplManager { | 66 class MockVideoCaptureImplManager : public VideoCaptureImplManager { |
| 68 public: | 67 public: |
| 69 MockVideoCaptureImplManager() {} | 68 MockVideoCaptureImplManager() {} |
| 70 virtual ~MockVideoCaptureImplManager() {} | |
| 71 | 69 |
| 72 MOCK_METHOD2(AddDevice, | 70 MOCK_METHOD2(AddDevice, |
| 73 media::VideoCapture*(media::VideoCaptureSessionId id, | 71 media::VideoCapture*(media::VideoCaptureSessionId id, |
| 74 media::VideoCapture::EventHandler* handler)); | 72 media::VideoCapture::EventHandler* handler)); |
| 75 MOCK_METHOD2(RemoveDevice, | 73 MOCK_METHOD2(RemoveDevice, |
| 76 void(media::VideoCaptureSessionId id, | 74 void(media::VideoCaptureSessionId id, |
| 77 media::VideoCapture::EventHandler* handler)); | 75 media::VideoCapture::EventHandler* handler)); |
| 78 | 76 |
| 77 protected: |
| 78 virtual ~MockVideoCaptureImplManager() {} |
| 79 |
| 79 private: | 80 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureImplManager); | 81 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureImplManager); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 class CaptureVideoDecoderTest : public ::testing::Test { | 84 class CaptureVideoDecoderTest : public ::testing::Test { |
| 84 protected: | 85 protected: |
| 85 CaptureVideoDecoderTest() { | 86 CaptureVideoDecoderTest() { |
| 86 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); | 87 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); |
| 87 message_loop_proxy_ = | 88 message_loop_proxy_ = |
| 88 base::MessageLoopProxy::current().get(); | 89 base::MessageLoopProxy::current().get(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 params.session_id = kVideoStreamId; | 209 params.session_id = kVideoStreamId; |
| 209 | 210 |
| 210 decoder_->OnDeviceInfoReceived(vc_impl_.get(), params); | 211 decoder_->OnDeviceInfoReceived(vc_impl_.get(), params); |
| 211 message_loop_->RunAllPending(); | 212 message_loop_->RunAllPending(); |
| 212 | 213 |
| 213 EXPECT_EQ(expected_size.width(), decoder_->natural_size().width()); | 214 EXPECT_EQ(expected_size.width(), decoder_->natural_size().width()); |
| 214 EXPECT_EQ(expected_size.height(), decoder_->natural_size().height()); | 215 EXPECT_EQ(expected_size.height(), decoder_->natural_size().height()); |
| 215 | 216 |
| 216 Stop(); | 217 Stop(); |
| 217 } | 218 } |
| OLD | NEW |