OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "media/video/capture/fake_video_capture_device.h" | 10 #include "media/video/capture/fake_video_capture_device.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) { | 144 TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) { |
145 scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices()); | 145 scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices()); |
146 | 146 |
147 VideoCaptureFormats supported_formats; | 147 VideoCaptureFormats supported_formats; |
148 VideoCaptureDevice::Names::iterator names_iterator; | 148 VideoCaptureDevice::Names::iterator names_iterator; |
149 | 149 |
150 for (names_iterator = names->begin(); names_iterator != names->end(); | 150 for (names_iterator = names->begin(); names_iterator != names->end(); |
151 ++names_iterator) { | 151 ++names_iterator) { |
152 video_capture_device_factory_->GetDeviceSupportedFormats( | 152 video_capture_device_factory_->GetDeviceSupportedFormats( |
153 *names_iterator, &supported_formats); | 153 *names_iterator, &supported_formats); |
154 EXPECT_EQ(supported_formats.size(), 3u); | 154 EXPECT_EQ(supported_formats.size(), 4u); |
155 EXPECT_EQ(supported_formats[0].frame_size.width(), 320); | 155 EXPECT_EQ(supported_formats[0].frame_size.width(), 320); |
156 EXPECT_EQ(supported_formats[0].frame_size.height(), 240); | 156 EXPECT_EQ(supported_formats[0].frame_size.height(), 240); |
157 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); | 157 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); |
158 EXPECT_GE(supported_formats[0].frame_rate, 20); | 158 EXPECT_GE(supported_formats[0].frame_rate, 20); |
159 EXPECT_EQ(supported_formats[1].frame_size.width(), 640); | 159 EXPECT_EQ(supported_formats[1].frame_size.width(), 640); |
160 EXPECT_EQ(supported_formats[1].frame_size.height(), 480); | 160 EXPECT_EQ(supported_formats[1].frame_size.height(), 480); |
161 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 161 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
162 EXPECT_GE(supported_formats[1].frame_rate, 20); | 162 EXPECT_GE(supported_formats[1].frame_rate, 20); |
163 EXPECT_EQ(supported_formats[2].frame_size.width(), 1280); | 163 EXPECT_EQ(supported_formats[2].frame_size.width(), 1280); |
164 EXPECT_EQ(supported_formats[2].frame_size.height(), 720); | 164 EXPECT_EQ(supported_formats[2].frame_size.height(), 720); |
165 EXPECT_EQ(supported_formats[2].pixel_format, media::PIXEL_FORMAT_I420); | 165 EXPECT_EQ(supported_formats[2].pixel_format, media::PIXEL_FORMAT_I420); |
166 EXPECT_GE(supported_formats[2].frame_rate, 20); | 166 EXPECT_GE(supported_formats[2].frame_rate, 20); |
| 167 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); |
| 168 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); |
| 169 EXPECT_EQ(supported_formats[3].pixel_format, media::PIXEL_FORMAT_I420); |
| 170 EXPECT_GE(supported_formats[3].frame_rate, 20); |
167 } | 171 } |
168 } | 172 } |
169 | 173 |
170 // Disabled, http://crbug.com/407061 . | 174 // Disabled, http://crbug.com/407061 . |
171 TEST_F(FakeVideoCaptureDeviceTest, DISABLED_CaptureVariableResolution) { | 175 TEST_F(FakeVideoCaptureDeviceTest, DISABLED_CaptureVariableResolution) { |
172 scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices()); | 176 scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices()); |
173 | 177 |
174 VideoCaptureParams capture_params; | 178 VideoCaptureParams capture_params; |
175 capture_params.requested_format.frame_size.SetSize(640, 480); | 179 capture_params.requested_format.frame_size.SetSize(640, 480); |
176 capture_params.requested_format.frame_rate = 30; | 180 capture_params.requested_format.frame_rate = 30; |
(...skipping 22 matching lines...) Expand all Loading... |
199 | 203 |
200 // We set TimeWait to 200 action timeouts and this should be enough for at | 204 // We set TimeWait to 200 action timeouts and this should be enough for at |
201 // least action_count/kFakeCaptureCapabilityChangePeriod calls. | 205 // least action_count/kFakeCaptureCapabilityChangePeriod calls. |
202 for (int i = 0; i < action_count; ++i) { | 206 for (int i = 0; i < action_count; ++i) { |
203 WaitForCapturedFrame(); | 207 WaitForCapturedFrame(); |
204 } | 208 } |
205 device->StopAndDeAllocate(); | 209 device->StopAndDeAllocate(); |
206 } | 210 } |
207 | 211 |
208 }; // namespace media | 212 }; // namespace media |
OLD | NEW |