| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 DeliverVideoFrameAndWaitForRenderer(1280, 720, &sink); | 674 DeliverVideoFrameAndWaitForRenderer(1280, 720, &sink); |
| 675 | 675 |
| 676 EXPECT_EQ(3, sink.number_of_frames()); | 676 EXPECT_EQ(3, sink.number_of_frames()); |
| 677 // Expect a frame to be cropped since its larger than max requested. | 677 // Expect a frame to be cropped since its larger than max requested. |
| 678 EXPECT_EQ(800, sink.frame_size().width()); | 678 EXPECT_EQ(800, sink.frame_size().width()); |
| 679 EXPECT_EQ(700, sink.frame_size().height()); | 679 EXPECT_EQ(700, sink.frame_size().height()); |
| 680 | 680 |
| 681 sink.DisconnectFromTrack(); | 681 sink.DisconnectFromTrack(); |
| 682 } | 682 } |
| 683 | 683 |
| 684 TEST_F(MediaStreamVideoSourceTest, IsConstraintSupported) { | |
| 685 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 686 MediaStreamVideoSource::kMaxFrameRate)); | |
| 687 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 688 MediaStreamVideoSource::kMinFrameRate)); | |
| 689 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 690 MediaStreamVideoSource::kMaxWidth)); | |
| 691 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 692 MediaStreamVideoSource::kMinWidth)); | |
| 693 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 694 MediaStreamVideoSource::kMaxHeight)); | |
| 695 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 696 MediaStreamVideoSource::kMinHeight)); | |
| 697 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 698 MediaStreamVideoSource::kMaxAspectRatio)); | |
| 699 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | |
| 700 MediaStreamVideoSource::kMinAspectRatio)); | |
| 701 | |
| 702 EXPECT_FALSE(MediaStreamVideoSource::IsConstraintSupported( | |
| 703 "something unsupported")); | |
| 704 } | |
| 705 | |
| 706 // Test that the constraint negotiation can handle 0.0 fps as frame rate. | 684 // Test that the constraint negotiation can handle 0.0 fps as frame rate. |
| 707 TEST_F(MediaStreamVideoSourceTest, Use0FpsSupportedFormat) { | 685 TEST_F(MediaStreamVideoSourceTest, Use0FpsSupportedFormat) { |
| 708 media::VideoCaptureFormats formats; | 686 media::VideoCaptureFormats formats; |
| 709 formats.push_back(media::VideoCaptureFormat( | 687 formats.push_back(media::VideoCaptureFormat( |
| 710 gfx::Size(640, 480), 0.0f, media::PIXEL_FORMAT_I420)); | 688 gfx::Size(640, 480), 0.0f, media::PIXEL_FORMAT_I420)); |
| 711 formats.push_back(media::VideoCaptureFormat( | 689 formats.push_back(media::VideoCaptureFormat( |
| 712 gfx::Size(320, 240), 0.0f, media::PIXEL_FORMAT_I420)); | 690 gfx::Size(320, 240), 0.0f, media::PIXEL_FORMAT_I420)); |
| 713 mock_source()->SetSupportedFormats(formats); | 691 mock_source()->SetSupportedFormats(formats); |
| 714 | 692 |
| 715 blink::WebMediaConstraints constraints; | 693 blink::WebMediaConstraints constraints; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 run_loop2.Run(); | 750 run_loop2.Run(); |
| 773 | 751 |
| 774 EXPECT_EQ(muted_state, false); | 752 EXPECT_EQ(muted_state, false); |
| 775 EXPECT_EQ(track.source().getReadyState(), | 753 EXPECT_EQ(track.source().getReadyState(), |
| 776 blink::WebMediaStreamSource::ReadyStateLive); | 754 blink::WebMediaStreamSource::ReadyStateLive); |
| 777 | 755 |
| 778 sink.DisconnectFromTrack(); | 756 sink.DisconnectFromTrack(); |
| 779 } | 757 } |
| 780 | 758 |
| 781 } // namespace content | 759 } // namespace content |
| OLD | NEW |