OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "media/base/video_frame.h" | 7 #include "media/base/video_frame.h" |
8 #include "media/mojo/common/media_type_converters.h" | 8 #include "media/mojo/common/media_type_converters.h" |
9 #include "services/video_capture/fake_device_test.h" | 9 #include "services/video_capture/fake_device_test.h" |
10 #include "services/video_capture/mock_video_frame_receiver.h" | 10 #include "services/video_capture/mock_video_frame_receiver.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 frame_info.is_mappable = video_frame->IsMappable(); | 70 frame_info.is_mappable = video_frame->IsMappable(); |
71 frame_info.size = video_frame->natural_size(); | 71 frame_info.size = video_frame->natural_size(); |
72 frame_info.timestamp = video_frame->timestamp(); | 72 frame_info.timestamp = video_frame->timestamp(); |
73 received_frame_count += 1; | 73 received_frame_count += 1; |
74 if (received_frame_count == num_frames_to_receive) { | 74 if (received_frame_count == num_frames_to_receive) { |
75 wait_loop.Quit(); | 75 wait_loop.Quit(); |
76 } | 76 } |
77 })); | 77 })); |
78 | 78 |
79 fake_device_proxy_->Start( | 79 fake_device_proxy_->Start( |
80 requestable_settings_.Clone(), std::move(receiver_proxy)); | 80 requestable_settings_, std::move(receiver_proxy)); |
81 | 81 |
82 wait_loop.Run(); | 82 wait_loop.Run(); |
83 | 83 |
84 base::TimeDelta previous_timestamp; | 84 base::TimeDelta previous_timestamp; |
85 for (int i = 0; i < num_frames_to_receive; i++) { | 85 for (int i = 0; i < num_frames_to_receive; i++) { |
86 auto& frame_info = received_frame_infos[i]; | 86 auto& frame_info = received_frame_infos[i]; |
87 // Service is expected to always output I420 | 87 // Service is expected to always output I420 |
88 ASSERT_EQ(media::PIXEL_FORMAT_I420, frame_info.pixel_format); | 88 ASSERT_EQ(media::PIXEL_FORMAT_I420, frame_info.pixel_format); |
89 // Service is expected to always use STORAGE_MOJO_SHARED_BUFFER | 89 // Service is expected to always use STORAGE_MOJO_SHARED_BUFFER |
90 ASSERT_EQ(media::VideoFrame::STORAGE_MOJO_SHARED_BUFFER, | 90 ASSERT_EQ(media::VideoFrame::STORAGE_MOJO_SHARED_BUFFER, |
91 frame_info.storage_type); | 91 frame_info.storage_type); |
92 ASSERT_TRUE(frame_info.is_mappable); | 92 ASSERT_TRUE(frame_info.is_mappable); |
93 ASSERT_EQ(requestable_settings_->format->frame_size, | 93 ASSERT_EQ(requestable_settings_.requested_format.frame_size, |
94 frame_info.size); | 94 frame_info.size); |
95 // Timestamps are expected to increase | 95 // Timestamps are expected to increase |
96 if (i > 0) { | 96 if (i > 0) { |
97 ASSERT_GT(frame_info.timestamp, previous_timestamp); | 97 ASSERT_GT(frame_info.timestamp, previous_timestamp); |
98 } | 98 } |
99 previous_timestamp = frame_info.timestamp; | 99 previous_timestamp = frame_info.timestamp; |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 } // namespace video_capture | 103 } // namespace video_capture |
OLD | NEW |