| Index: services/video_capture/test/fake_device_unittest.cc
|
| diff --git a/services/video_capture/test/fake_device_unittest.cc b/services/video_capture/test/fake_device_unittest.cc
|
| index ee2d651830e5a4b8c954e65b7062267e970b594c..6550909bc9425d510c498911b25ba63e8fdbbb81 100644
|
| --- a/services/video_capture/test/fake_device_unittest.cc
|
| +++ b/services/video_capture/test/fake_device_unittest.cc
|
| @@ -12,7 +12,6 @@
|
| #include "services/video_capture/test/mock_receiver.h"
|
|
|
| using testing::_;
|
| -using testing::AtLeast;
|
| using testing::Invoke;
|
| using testing::InvokeWithoutArgs;
|
|
|
| @@ -21,7 +20,7 @@
|
| struct FrameInfo {
|
| gfx::Size size;
|
| media::VideoPixelFormat pixel_format;
|
| - media::VideoPixelStorage storage_type;
|
| + media::VideoFrame::StorageType storage_type;
|
| base::TimeDelta timestamp;
|
| };
|
|
|
| @@ -33,23 +32,23 @@
|
| // TODO(rockot/chfremer): Consider just renaming the type.
|
| using FakeVideoCaptureDeviceTest = FakeDeviceTest;
|
|
|
| -TEST_F(FakeVideoCaptureDeviceTest, FrameCallbacksArrive) {
|
| +TEST_F(FakeVideoCaptureDeviceTest, DISABLED_FrameCallbacksArrive) {
|
| base::RunLoop wait_loop;
|
| - // Constants must be static as a workaround
|
| + // These two constants must be static as a workaround
|
| // for a MSVC++ bug about lambda captures, see the discussion at
|
| // https://social.msdn.microsoft.com/Forums/SqlServer/4abf18bd-4ae4-4c72-ba3e-3b13e7909d5f
|
| static const int kNumFramesToWaitFor = 3;
|
| int num_frames_arrived = 0;
|
| mojom::ReceiverPtr receiver_proxy;
|
| MockReceiver receiver(mojo::MakeRequest(&receiver_proxy));
|
| - EXPECT_CALL(receiver, DoOnNewBufferHandle(_, _)).Times(AtLeast(1));
|
| - EXPECT_CALL(receiver, DoOnFrameReadyInBuffer(_, _, _, _))
|
| - .WillRepeatedly(InvokeWithoutArgs([&wait_loop, &num_frames_arrived]() {
|
| - num_frames_arrived += 1;
|
| - if (num_frames_arrived >= kNumFramesToWaitFor) {
|
| - wait_loop.Quit();
|
| - }
|
| - }));
|
| + EXPECT_CALL(receiver, OnIncomingCapturedVideoFramePtr(_))
|
| + .WillRepeatedly(InvokeWithoutArgs(
|
| + [&wait_loop, &num_frames_arrived]() {
|
| + num_frames_arrived += 1;
|
| + if (num_frames_arrived >= kNumFramesToWaitFor) {
|
| + wait_loop.Quit();
|
| + }
|
| + }));
|
|
|
| fake_device_proxy_->Start(requestable_settings_, std::move(receiver_proxy));
|
| wait_loop.Run();
|
| @@ -57,31 +56,29 @@
|
|
|
| // Tests that frames received from a fake capture device match the requested
|
| // format and have increasing timestamps.
|
| -TEST_F(FakeVideoCaptureDeviceTest, ReceiveFramesFromFakeCaptureDevice) {
|
| +TEST_F(FakeVideoCaptureDeviceTest,
|
| + DISABLED_ReceiveFramesFromFakeCaptureDevice) {
|
| base::RunLoop wait_loop;
|
| mojom::ReceiverPtr receiver_proxy;
|
| - // Constants must be static as a workaround
|
| + // These two constants must be static as a workaround
|
| // for a MSVC++ bug about lambda captures, see the discussion at
|
| // https://social.msdn.microsoft.com/Forums/SqlServer/4abf18bd-4ae4-4c72-ba3e-3b13e7909d5f
|
| static const int num_frames_to_receive = 2;
|
| FrameInfo received_frame_infos[num_frames_to_receive];
|
| int received_frame_count = 0;
|
| MockReceiver receiver(mojo::MakeRequest(&receiver_proxy));
|
| - EXPECT_CALL(receiver, DoOnNewBufferHandle(_, _)).Times(AtLeast(1));
|
| - EXPECT_CALL(receiver, DoOnFrameReadyInBuffer(_, _, _, _))
|
| - .WillRepeatedly(
|
| - Invoke([&received_frame_infos, &received_frame_count, &wait_loop](
|
| - int32_t buffer_id, int32_t frame_feedback_id,
|
| - mojom::ScopedAccessPermissionPtr* access_permission,
|
| - media::mojom::VideoFrameInfoPtr* frame_info) {
|
| + EXPECT_CALL(receiver, OnIncomingCapturedVideoFramePtr(_))
|
| + .WillRepeatedly(Invoke(
|
| + [&received_frame_infos, &received_frame_count, &wait_loop]
|
| + (const media::mojom::VideoFramePtr* frame) {
|
| if (received_frame_count >= num_frames_to_receive)
|
| return;
|
| - auto& received_frame_info =
|
| - received_frame_infos[received_frame_count];
|
| - received_frame_info.pixel_format = (*frame_info)->pixel_format;
|
| - received_frame_info.storage_type = (*frame_info)->storage_type;
|
| - received_frame_info.size = (*frame_info)->coded_size;
|
| - received_frame_info.timestamp = (*frame_info)->timestamp;
|
| + auto video_frame = frame->To<scoped_refptr<media::VideoFrame>>();
|
| + auto& frame_info = received_frame_infos[received_frame_count];
|
| + frame_info.pixel_format = video_frame->format();
|
| + frame_info.storage_type = video_frame->storage_type();
|
| + frame_info.size = video_frame->natural_size();
|
| + frame_info.timestamp = video_frame->timestamp();
|
| received_frame_count += 1;
|
| if (received_frame_count == num_frames_to_receive)
|
| wait_loop.Quit();
|
| @@ -96,10 +93,9 @@
|
| auto& frame_info = received_frame_infos[i];
|
| // Service is expected to always output I420
|
| EXPECT_EQ(media::PIXEL_FORMAT_I420, frame_info.pixel_format);
|
| - // Service is expected to always use PIXEL_STORAGE_CPU
|
| - EXPECT_EQ(media::PIXEL_STORAGE_CPU, frame_info.storage_type);
|
| - EXPECT_EQ(requestable_settings_.requested_format.frame_size,
|
| - frame_info.size);
|
| + // Service is expected to always use STORAGE_MOJO_SHARED_BUFFER
|
| + EXPECT_EQ(media::VideoFrame::STORAGE_MOJO_SHARED_BUFFER,
|
| + frame_info.storage_type);
|
| // Timestamps are expected to increase
|
| if (i > 0)
|
| EXPECT_GT(frame_info.timestamp, previous_timestamp);
|
| @@ -107,35 +103,4 @@
|
| }
|
| }
|
|
|
| -// Tests that buffers get reused when receiving more frames than the maximum
|
| -// number of buffers in the pool.
|
| -TEST_F(FakeVideoCaptureDeviceTest, BuffersGetReused) {
|
| - base::RunLoop wait_loop;
|
| - const int kMaxBufferPoolBuffers =
|
| - DeviceMediaToMojoAdapter::max_buffer_pool_buffer_count();
|
| - // Constants must be static as a workaround
|
| - // for a MSVC++ bug about lambda captures, see the discussion at
|
| - // https://social.msdn.microsoft.com/Forums/SqlServer/4abf18bd-4ae4-4c72-ba3e-3b13e7909d5f
|
| - static const int kNumFramesToWaitFor = kMaxBufferPoolBuffers + 3;
|
| - int num_buffers_created = 0;
|
| - int num_frames_arrived = 0;
|
| - mojom::ReceiverPtr receiver_proxy;
|
| - MockReceiver receiver(mojo::MakeRequest(&receiver_proxy));
|
| - EXPECT_CALL(receiver, DoOnNewBufferHandle(_, _))
|
| - .WillRepeatedly(InvokeWithoutArgs(
|
| - [&num_buffers_created]() { num_buffers_created++; }));
|
| - EXPECT_CALL(receiver, DoOnFrameReadyInBuffer(_, _, _, _))
|
| - .WillRepeatedly(InvokeWithoutArgs([&wait_loop, &num_frames_arrived]() {
|
| - if (++num_frames_arrived >= kNumFramesToWaitFor) {
|
| - wait_loop.Quit();
|
| - }
|
| - }));
|
| -
|
| - fake_device_proxy_->Start(requestable_settings_, std::move(receiver_proxy));
|
| - wait_loop.Run();
|
| -
|
| - ASSERT_LT(num_buffers_created, num_frames_arrived);
|
| - ASSERT_LE(num_buffers_created, kMaxBufferPoolBuffers);
|
| -}
|
| -
|
| } // namespace video_capture
|
|
|