| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 DeliverVideoFrameAndWaitForRenderer(640, 480, &sink); | 775 DeliverVideoFrameAndWaitForRenderer(640, 480, &sink); |
| 776 run_loop2.Run(); | 776 run_loop2.Run(); |
| 777 | 777 |
| 778 EXPECT_EQ(muted_state, false); | 778 EXPECT_EQ(muted_state, false); |
| 779 EXPECT_EQ(track.source().getReadyState(), | 779 EXPECT_EQ(track.source().getReadyState(), |
| 780 blink::WebMediaStreamSource::ReadyStateLive); | 780 blink::WebMediaStreamSource::ReadyStateLive); |
| 781 | 781 |
| 782 sink.DisconnectFromTrack(); | 782 sink.DisconnectFromTrack(); |
| 783 } | 783 } |
| 784 | 784 |
| 785 // Test that an optional constraint with an invalid aspect ratio is ignored. |
| 786 TEST_F(MediaStreamVideoSourceTest, InvalidOptionalAspectRatioIgnored) { |
| 787 MockConstraintFactory factory; |
| 788 factory.AddAdvanced().aspectRatio.setMax(0.0); |
| 789 blink::WebMediaStreamTrack track = |
| 790 CreateTrack("123", factory.CreateWebMediaConstraints()); |
| 791 mock_source()->CompleteGetSupportedFormats(); |
| 792 EXPECT_EQ(0, NumberOfFailedConstraintsCallbacks()); |
| 793 } |
| 794 |
| 795 // Test that setting an invalid mandatory aspect ratio fails. |
| 796 TEST_F(MediaStreamVideoSourceTest, InvalidMandatoryAspectRatioFails) { |
| 797 MockConstraintFactory factory; |
| 798 factory.basic().aspectRatio.setMax(0.0); |
| 799 blink::WebMediaStreamTrack track = |
| 800 CreateTrack("123", factory.CreateWebMediaConstraints()); |
| 801 mock_source()->CompleteGetSupportedFormats(); |
| 802 EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); |
| 803 } |
| 804 |
| 785 } // namespace content | 805 } // namespace content |
| OLD | NEW |