Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: content/renderer/media/media_stream_video_source_unittest.cc

Issue 2632633004: Ignore invalid optional constraints with invalid aspect ratio. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/media/media_stream_video_source.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698