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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/media_stream_video_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_video_source_unittest.cc
diff --git a/content/renderer/media/media_stream_video_source_unittest.cc b/content/renderer/media/media_stream_video_source_unittest.cc
index bfb572d39c967af699b58496694d9852d6d16d5b..dfeea8edf4ba6755c0ecca5759573121af102559 100644
--- a/content/renderer/media/media_stream_video_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_source_unittest.cc
@@ -782,4 +782,24 @@ TEST_F(MediaStreamVideoSourceTest, MutedSource) {
sink.DisconnectFromTrack();
}
+// Test that an optional constraint with an invalid aspect ratio is ignored.
+TEST_F(MediaStreamVideoSourceTest, InvalidOptionalAspectRatioIgnored) {
+ MockConstraintFactory factory;
+ factory.AddAdvanced().aspectRatio.setMax(0.0);
+ blink::WebMediaStreamTrack track =
+ CreateTrack("123", factory.CreateWebMediaConstraints());
+ mock_source()->CompleteGetSupportedFormats();
+ EXPECT_EQ(0, NumberOfFailedConstraintsCallbacks());
+}
+
+// Test that setting an invalid mandatory aspect ratio fails.
+TEST_F(MediaStreamVideoSourceTest, InvalidMandatoryAspectRatioFails) {
+ MockConstraintFactory factory;
+ factory.basic().aspectRatio.setMax(0.0);
+ blink::WebMediaStreamTrack track =
+ CreateTrack("123", factory.CreateWebMediaConstraints());
+ mock_source()->CompleteGetSupportedFormats();
+ EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks());
+}
+
} // namespace content
« 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