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 "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "content/child/child_process.h" | 7 #include "content/child/child_process.h" |
8 #include "content/common/media/video_capture_messages.h" | 8 #include "content/common/media/video_capture_messages.h" |
9 #include "content/renderer/media/video_capture_impl.h" | 9 #include "content/renderer/media/video_capture_impl.h" |
10 #include "media/base/bind_to_current_loop.h" | 10 #include "media/base/bind_to_current_loop.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 BufferReceivedTestArg(media::VideoPixelFormat pixel_format) | 41 BufferReceivedTestArg(media::VideoPixelFormat pixel_format) |
42 : pixel_format(pixel_format) {} | 42 : pixel_format(pixel_format) {} |
43 | 43 |
44 media::VideoPixelFormat pixel_format; | 44 media::VideoPixelFormat pixel_format; |
45 gpu::MailboxHolder mailbox_holder; | 45 gpu::MailboxHolder mailbox_holder; |
46 }; | 46 }; |
47 | 47 |
48 static const BufferReceivedTestArg kBufferFormats[] = { | 48 static const BufferReceivedTestArg kBufferFormats[] = { |
49 BufferReceivedTestArg(media::PIXEL_FORMAT_I420), | 49 BufferReceivedTestArg(media::PIXEL_FORMAT_I420), |
50 BufferReceivedTestArg(media::PIXEL_FORMAT_ARGB, | 50 BufferReceivedTestArg( |
51 gpu::MailboxHolder(gpu::Mailbox::Generate(), 0, 0))}; | 51 media::PIXEL_FORMAT_ARGB, |
| 52 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 0))}; |
52 | 53 |
53 class VideoCaptureImplTest | 54 class VideoCaptureImplTest |
54 : public ::testing::TestWithParam<BufferReceivedTestArg> { | 55 : public ::testing::TestWithParam<BufferReceivedTestArg> { |
55 public: | 56 public: |
56 class MockVideoCaptureImpl : public VideoCaptureImpl { | 57 class MockVideoCaptureImpl : public VideoCaptureImpl { |
57 public: | 58 public: |
58 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, | 59 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, |
59 VideoCaptureMessageFilter* filter) | 60 VideoCaptureMessageFilter* filter) |
60 : VideoCaptureImpl(id, filter), received_buffer_count_(0) {} | 61 : VideoCaptureImpl(id, filter), received_buffer_count_(0) {} |
61 ~MockVideoCaptureImpl() override {} | 62 ~MockVideoCaptureImpl() override {} |
(...skipping 29 matching lines...) Expand all Loading... |
91 } | 92 } |
92 | 93 |
93 void DevicePauseCapture(int device_id) {} | 94 void DevicePauseCapture(int device_id) {} |
94 | 95 |
95 void DeviceStopCapture(int device_id) { | 96 void DeviceStopCapture(int device_id) { |
96 OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED); | 97 OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED); |
97 } | 98 } |
98 | 99 |
99 void DeviceReceiveEmptyBuffer(int device_id, | 100 void DeviceReceiveEmptyBuffer(int device_id, |
100 int buffer_id, | 101 int buffer_id, |
101 uint32 sync_point, | 102 const gpu::SyncToken& release_sync_token, |
102 double consumer_resource_utilization) { | 103 double consumer_resource_utilization) { |
103 received_buffer_count_++; | 104 received_buffer_count_++; |
104 } | 105 } |
105 | 106 |
106 void DeviceGetSupportedFormats(int device_id, | 107 void DeviceGetSupportedFormats(int device_id, |
107 media::VideoCaptureSessionId session_id) { | 108 media::VideoCaptureSessionId session_id) { |
108 // When the mock message filter receives a request for the device | 109 // When the mock message filter receives a request for the device |
109 // supported formats, replies immediately with an empty format list. | 110 // supported formats, replies immediately with an empty format list. |
110 OnDeviceSupportedFormatsEnumerated(media::VideoCaptureFormats()); | 111 OnDeviceSupportedFormatsEnumerated(media::VideoCaptureFormats()); |
111 } | 112 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 StartCapture(0, params_small_); | 399 StartCapture(0, params_small_); |
399 | 400 |
400 // Receive state change message from browser. | 401 // Receive state change message from browser. |
401 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); | 402 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); |
402 | 403 |
403 StopCapture(0); | 404 StopCapture(0); |
404 DeInit(); | 405 DeInit(); |
405 } | 406 } |
406 | 407 |
407 } // namespace content | 408 } // namespace content |
OLD | NEW |