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

Unified Diff: content/renderer/media/media_stream_video_source_unittest.cc

Issue 2231863004: Add "exact" constraint evaluation to video picker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Guido's comments Created 4 years, 4 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 64395970c04f3ef16ffc8587202a8c8fff57a068..bfb572d39c967af699b58496694d9852d6d16d5b 100644
--- a/content/renderer/media/media_stream_video_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_source_unittest.cc
@@ -314,6 +314,14 @@ TEST_F(MediaStreamVideoSourceTest, MandatoryMinVgaOptional720P) {
CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30);
}
+// Test that the capture output is 720P if the camera supports it and the
+// mandatory constraint is exactly width 1280.
+TEST_F(MediaStreamVideoSourceTest, MandatoryExact720P) {
+ MockConstraintFactory factory;
+ factory.basic().width.setExact(1280);
+ CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30);
+}
+
// Test that the capture output have aspect ratio 4:3 if a mandatory constraint
// require it even if an optional constraint request a higher resolution
// that don't have this aspect ratio.
@@ -373,8 +381,26 @@ TEST_F(MediaStreamVideoSourceTest, MinFrameRateLargerThanMaxFrameRate) {
MockConstraintFactory factory;
factory.basic().frameRate.setMin(25);
factory.basic().frameRate.setMax(15);
- blink::WebMediaStreamTrack track = CreateTrack(
- "123", factory.CreateWebMediaConstraints());
+ blink::WebMediaStreamTrack track =
+ CreateTrack("123", factory.CreateWebMediaConstraints());
+ mock_source()->CompleteGetSupportedFormats();
+ EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks());
+}
+
+TEST_F(MediaStreamVideoSourceTest, ExactWidthNotSupported) {
+ MockConstraintFactory factory;
+ factory.basic().width.setExact(12000);
+ blink::WebMediaStreamTrack track =
+ CreateTrack("123", factory.CreateWebMediaConstraints());
+ mock_source()->CompleteGetSupportedFormats();
+ EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks());
+}
+
+TEST_F(MediaStreamVideoSourceTest, MinWidthNotSupported) {
+ MockConstraintFactory factory;
+ factory.basic().width.setMin(12000);
+ blink::WebMediaStreamTrack track =
+ CreateTrack("123", factory.CreateWebMediaConstraints());
mock_source()->CompleteGetSupportedFormats();
EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks());
}
« 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