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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // Test that the source crops to the requested max width and | 90 // Test that the source crops to the requested max width and |
91 // height even though the camera delivers a larger frame. | 91 // height even though the camera delivers a larger frame. |
92 void TestSourceCropFrame(int capture_width, | 92 void TestSourceCropFrame(int capture_width, |
93 int capture_height, | 93 int capture_height, |
94 const blink::WebMediaConstraints& constraints, | 94 const blink::WebMediaConstraints& constraints, |
95 int expected_width, | 95 int expected_width, |
96 int expected_height) { | 96 int expected_height) { |
97 // Expect the source to start capture with the supported resolution. | 97 // Expect the source to start capture with the supported resolution. |
98 blink::WebMediaStreamTrack track = | 98 blink::WebMediaStreamTrack track = |
99 CreateTrackAndStartSource(constraints, capture_width, capture_height , | 99 CreateTrackAndStartSource(constraints, capture_width, capture_height, |
100 30); | 100 30); |
101 | 101 |
102 MockMediaStreamVideoSink sink; | 102 MockMediaStreamVideoSink sink; |
103 MediaStreamVideoSink::AddToVideoTrack(&sink, track); | 103 MediaStreamVideoSink::AddToVideoTrack(&sink, track); |
104 EXPECT_EQ(0, sink.number_of_frames()); | 104 EXPECT_EQ(0, sink.number_of_frames()); |
105 | 105 |
106 scoped_refptr<media::VideoFrame> frame = | 106 scoped_refptr<media::VideoFrame> frame = |
107 media::VideoFrame::CreateBlackFrame(gfx::Size(capture_width, | 107 media::VideoFrame::CreateBlackFrame(gfx::Size(capture_width, |
108 capture_height)); | 108 capture_height)); |
109 mock_source()->DeliverVideoFrame(frame, media::VideoCaptureFormat()); | 109 mock_source()->DeliverVideoFrame(frame, media::VideoCaptureFormat()); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | 469 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( |
470 MediaStreamVideoSource::kMaxAspectRatio)); | 470 MediaStreamVideoSource::kMaxAspectRatio)); |
471 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | 471 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( |
472 MediaStreamVideoSource::kMinAspectRatio)); | 472 MediaStreamVideoSource::kMinAspectRatio)); |
473 | 473 |
474 EXPECT_FALSE(MediaStreamVideoSource::IsConstraintSupported( | 474 EXPECT_FALSE(MediaStreamVideoSource::IsConstraintSupported( |
475 "something unsupported")); | 475 "something unsupported")); |
476 } | 476 } |
477 | 477 |
478 } // namespace content | 478 } // namespace content |
OLD | NEW |