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

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

Issue 2919973003: Revert of Change default minimum screencast frame rate to zero. (Closed)
Patch Set: Created 3 years, 6 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_constraints_util_video_content.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "content/renderer/media/media_stream_constraints_util_video_content.h" 5 #include "content/renderer/media/media_stream_constraints_util_video_content.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "content/common/media/media_stream_options.h" 10 #include "content/common/media/media_stream_options.h"
11 #include "content/renderer/media/mock_constraint_factory.h" 11 #include "content/renderer/media/mock_constraint_factory.h"
12 #include "media/base/limits.h" 12 #include "media/base/limits.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 14 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 namespace { 18 namespace {
19 19
20 void CheckNonResolutionDefaults(const VideoCaptureSettings& result) { 20 void CheckNonResolutionDefaults(const VideoCaptureSettings& result) {
21 EXPECT_EQ(kDefaultScreenCastFrameRate, result.FrameRate()); 21 EXPECT_EQ(kDefaultScreenCastFrameRate, result.FrameRate());
22 EXPECT_EQ(base::Optional<bool>(), result.noise_reduction()); 22 EXPECT_EQ(base::Optional<bool>(), result.noise_reduction());
23 EXPECT_EQ(std::string(), result.device_id()); 23 EXPECT_EQ(std::string(), result.device_id());
24 EXPECT_EQ(0.0, result.min_frame_rate());
25 } 24 }
26 25
27 void CheckNonFrameRateDefaults(const VideoCaptureSettings& result) { 26 void CheckNonFrameRateDefaults(const VideoCaptureSettings& result) {
28 EXPECT_EQ(kDefaultScreenCastHeight, result.Height()); 27 EXPECT_EQ(kDefaultScreenCastHeight, result.Height());
29 EXPECT_EQ(kDefaultScreenCastWidth, result.Width()); 28 EXPECT_EQ(kDefaultScreenCastWidth, result.Width());
30 EXPECT_EQ(base::Optional<bool>(), result.noise_reduction()); 29 EXPECT_EQ(base::Optional<bool>(), result.noise_reduction());
31 EXPECT_EQ(std::string(), result.device_id()); 30 EXPECT_EQ(std::string(), result.device_id());
32 } 31 }
33 32
34 void CheckTrackAdapterSettingsEqualsFormat(const VideoCaptureSettings& result) { 33 void CheckTrackAdapterSettingsEqualsFormat(const VideoCaptureSettings& result) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 result.failed_constraint_name()); 159 result.failed_constraint_name());
161 160
162 constraint_factory_.Reset(); 161 constraint_factory_.Reset();
163 constraint_factory_.basic().frame_rate.SetMin(kMaxScreenCastFrameRate + 0.1); 162 constraint_factory_.basic().frame_rate.SetMin(kMaxScreenCastFrameRate + 0.1);
164 result = SelectSettings(); 163 result = SelectSettings();
165 EXPECT_FALSE(result.HasValue()); 164 EXPECT_FALSE(result.HasValue());
166 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(), 165 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(),
167 result.failed_constraint_name()); 166 result.failed_constraint_name());
168 167
169 constraint_factory_.Reset(); 168 constraint_factory_.Reset();
170 constraint_factory_.basic().frame_rate.SetMax(-0.1); 169 constraint_factory_.basic().frame_rate.SetMax(kMinScreenCastFrameRate - 0.1);
171 result = SelectSettings(); 170 result = SelectSettings();
172 EXPECT_FALSE(result.HasValue()); 171 EXPECT_FALSE(result.HasValue());
173 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(), 172 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(),
174 result.failed_constraint_name()); 173 result.failed_constraint_name());
175 } 174 }
176 175
177 // The "Mandatory" and "Ideal" tests check that various selection criteria work 176 // The "Mandatory" and "Ideal" tests check that various selection criteria work
178 // for each individual constraint in the basic constraint set. 177 // for each individual constraint in the basic constraint set.
179 TEST_F(MediaStreamConstraintsUtilVideoContentTest, MandatoryDeviceID) { 178 TEST_F(MediaStreamConstraintsUtilVideoContentTest, MandatoryDeviceID) {
180 const std::string kDeviceID = "Some ID"; 179 const std::string kDeviceID = "Some ID";
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 // Only specifying a maximum resolution allows resolution adjustment. 2062 // Only specifying a maximum resolution allows resolution adjustment.
2064 EXPECT_EQ(media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT, 2063 EXPECT_EQ(media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT,
2065 result.ResolutionChangePolicy()); 2064 result.ResolutionChangePolicy());
2066 EXPECT_EQ(1.0 / 4000, result.track_adapter_settings().min_aspect_ratio); 2065 EXPECT_EQ(1.0 / 4000, result.track_adapter_settings().min_aspect_ratio);
2067 EXPECT_EQ(4000.0, result.track_adapter_settings().max_aspect_ratio); 2066 EXPECT_EQ(4000.0, result.track_adapter_settings().max_aspect_ratio);
2068 CheckTrackAdapterSettingsEqualsFormat(result); 2067 CheckTrackAdapterSettingsEqualsFormat(result);
2069 } 2068 }
2070 } 2069 }
2071 2070
2072 } // namespace content 2071 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_constraints_util_video_content.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698