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

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

Issue 2929573002: Reland of Change default minimum screencast frame rate to zero. (patchset #1 id:1 of https://codere… (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());
24 } 25 }
25 26
26 void CheckNonFrameRateDefaults(const VideoCaptureSettings& result) { 27 void CheckNonFrameRateDefaults(const VideoCaptureSettings& result) {
27 EXPECT_EQ(kDefaultScreenCastHeight, result.Height()); 28 EXPECT_EQ(kDefaultScreenCastHeight, result.Height());
28 EXPECT_EQ(kDefaultScreenCastWidth, result.Width()); 29 EXPECT_EQ(kDefaultScreenCastWidth, result.Width());
29 EXPECT_EQ(base::Optional<bool>(), result.noise_reduction()); 30 EXPECT_EQ(base::Optional<bool>(), result.noise_reduction());
30 EXPECT_EQ(std::string(), result.device_id()); 31 EXPECT_EQ(std::string(), result.device_id());
31 } 32 }
32 33
33 void CheckTrackAdapterSettingsEqualsFormat(const VideoCaptureSettings& result) { 34 void CheckTrackAdapterSettingsEqualsFormat(const VideoCaptureSettings& result) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 result.failed_constraint_name()); 160 result.failed_constraint_name());
160 161
161 constraint_factory_.Reset(); 162 constraint_factory_.Reset();
162 constraint_factory_.basic().frame_rate.SetMin(kMaxScreenCastFrameRate + 0.1); 163 constraint_factory_.basic().frame_rate.SetMin(kMaxScreenCastFrameRate + 0.1);
163 result = SelectSettings(); 164 result = SelectSettings();
164 EXPECT_FALSE(result.HasValue()); 165 EXPECT_FALSE(result.HasValue());
165 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(), 166 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(),
166 result.failed_constraint_name()); 167 result.failed_constraint_name());
167 168
168 constraint_factory_.Reset(); 169 constraint_factory_.Reset();
169 constraint_factory_.basic().frame_rate.SetMax(kMinScreenCastFrameRate - 0.1); 170 constraint_factory_.basic().frame_rate.SetMax(-0.1);
170 result = SelectSettings(); 171 result = SelectSettings();
171 EXPECT_FALSE(result.HasValue()); 172 EXPECT_FALSE(result.HasValue());
172 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(), 173 EXPECT_EQ(constraint_factory_.basic().frame_rate.GetName(),
173 result.failed_constraint_name()); 174 result.failed_constraint_name());
174 } 175 }
175 176
176 // The "Mandatory" and "Ideal" tests check that various selection criteria work 177 // The "Mandatory" and "Ideal" tests check that various selection criteria work
177 // for each individual constraint in the basic constraint set. 178 // for each individual constraint in the basic constraint set.
178 TEST_F(MediaStreamConstraintsUtilVideoContentTest, MandatoryDeviceID) { 179 TEST_F(MediaStreamConstraintsUtilVideoContentTest, MandatoryDeviceID) {
179 const std::string kDeviceID = "Some ID"; 180 const std::string kDeviceID = "Some ID";
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 // Only specifying a maximum resolution allows resolution adjustment. 2063 // Only specifying a maximum resolution allows resolution adjustment.
2063 EXPECT_EQ(media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT, 2064 EXPECT_EQ(media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT,
2064 result.ResolutionChangePolicy()); 2065 result.ResolutionChangePolicy());
2065 EXPECT_EQ(1.0 / 4000, result.track_adapter_settings().min_aspect_ratio); 2066 EXPECT_EQ(1.0 / 4000, result.track_adapter_settings().min_aspect_ratio);
2066 EXPECT_EQ(4000.0, result.track_adapter_settings().max_aspect_ratio); 2067 EXPECT_EQ(4000.0, result.track_adapter_settings().max_aspect_ratio);
2067 CheckTrackAdapterSettingsEqualsFormat(result); 2068 CheckTrackAdapterSettingsEqualsFormat(result);
2068 } 2069 }
2069 } 2070 }
2070 2071
2071 } // namespace content 2072 } // 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