Chromium Code Reviews| 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/memory/shared_memory.h" | 5 #include "base/memory/shared_memory.h" |
| 6 #include "content/common/media/video_capture_messages.h" | 6 #include "content/common/media/video_capture_messages.h" |
| 7 #include "content/renderer/media/video_capture_message_filter.h" | 7 #include "content/renderer/media/video_capture_message_filter.h" |
| 8 #include "ipc/ipc_test_sink.h" | 8 #include "ipc/ipc_test_sink.h" |
| 9 #include "media/base/video_capture_types.h" | 9 #include "media/base/video_capture_types.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 using ::testing::WithArg; | 21 using ::testing::WithArg; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 class MockVideoCaptureDelegate : public VideoCaptureMessageFilter::Delegate { | 26 class MockVideoCaptureDelegate : public VideoCaptureMessageFilter::Delegate { |
| 27 public: | 27 public: |
| 28 MockVideoCaptureDelegate() : device_id_(0) {} | 28 MockVideoCaptureDelegate() : device_id_(0) {} |
| 29 | 29 |
| 30 // VideoCaptureMessageFilter::Delegate implementation. | 30 // VideoCaptureMessageFilter::Delegate implementation. |
| 31 MOCK_METHOD3(OnBufferCreated, void(base::SharedMemoryHandle handle, | 31 MOCK_METHOD3(OnBufferCreated, |
| 32 int length, | 32 void(base::SharedMemoryHandle handle, |
| 33 int buffer_id)); | 33 int length, |
| 34 int buffer_id)); | |
| 35 MOCK_METHOD3(OnBufferCreated2, | |
| 36 void(const std::vector<gfx::GpuMemoryBufferHandle>& gmb_handles, | |
|
reveman
2015/08/26 11:54:05
nit: s/gmb_handles/handles/
emircan
2015/08/26 21:23:12
Done.
| |
| 37 const gfx::Size& size, | |
| 38 int buffer_id)); | |
| 34 MOCK_METHOD1(OnBufferDestroyed, void(int buffer_id)); | 39 MOCK_METHOD1(OnBufferDestroyed, void(int buffer_id)); |
| 35 MOCK_METHOD8(OnBufferReceived, | 40 MOCK_METHOD8(OnBufferReceived, |
| 36 void(int buffer_id, | 41 void(int buffer_id, |
| 37 base::TimeTicks timestamp, | 42 base::TimeTicks timestamp, |
| 38 const base::DictionaryValue& metadata, | 43 const base::DictionaryValue& metadata, |
| 39 media::VideoPixelFormat pixel_format, | 44 media::VideoPixelFormat pixel_format, |
| 40 media::VideoFrame::StorageType storage_type, | 45 media::VideoFrame::StorageType storage_type, |
| 41 const gfx::Size& coded_size, | 46 const gfx::Size& coded_size, |
| 42 const gfx::Rect& visible_rect, | 47 const gfx::Rect& visible_rect, |
| 43 const gpu::MailboxHolder& mailbox_holder)); | 48 const gpu::MailboxHolder& mailbox_holders)); |
| 44 MOCK_METHOD1(OnStateChanged, void(VideoCaptureState state)); | 49 MOCK_METHOD1(OnStateChanged, void(VideoCaptureState state)); |
| 45 MOCK_METHOD1(OnDeviceSupportedFormatsEnumerated, | 50 MOCK_METHOD1(OnDeviceSupportedFormatsEnumerated, |
| 46 void(const media::VideoCaptureFormats& formats)); | 51 void(const media::VideoCaptureFormats& formats)); |
| 47 MOCK_METHOD1(OnDeviceFormatsInUseReceived, | 52 MOCK_METHOD1(OnDeviceFormatsInUseReceived, |
| 48 void(const media::VideoCaptureFormats& formats_in_use)); | 53 void(const media::VideoCaptureFormats& formats_in_use)); |
| 49 | 54 |
| 50 void OnDelegateAdded(int32 device_id) override { | 55 void OnDelegateAdded(int32 device_id) override { |
| 51 ASSERT_TRUE(device_id != 0); | 56 ASSERT_TRUE(device_id != 0); |
| 52 ASSERT_TRUE(device_id_ == 0); | 57 ASSERT_TRUE(device_id_ == 0); |
| 53 device_id_ = device_id; | 58 device_id_ = device_id; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 MockVideoCaptureDelegate delegate; | 226 MockVideoCaptureDelegate delegate; |
| 222 filter->AddDelegate(&delegate); | 227 filter->AddDelegate(&delegate); |
| 223 ASSERT_EQ(1, delegate.device_id()); | 228 ASSERT_EQ(1, delegate.device_id()); |
| 224 | 229 |
| 225 EXPECT_CALL(delegate, OnDeviceFormatsInUseReceived(_)); | 230 EXPECT_CALL(delegate, OnDeviceFormatsInUseReceived(_)); |
| 226 media::VideoCaptureFormats formats_in_use; | 231 media::VideoCaptureFormats formats_in_use; |
| 227 filter->OnMessageReceived(VideoCaptureMsg_DeviceFormatsInUseReceived( | 232 filter->OnMessageReceived(VideoCaptureMsg_DeviceFormatsInUseReceived( |
| 228 delegate.device_id(), formats_in_use)); | 233 delegate.device_id(), formats_in_use)); |
| 229 } | 234 } |
| 230 } // namespace content | 235 } // namespace content |
| OLD | NEW |