OLD | NEW |
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/renderer/media/mock_constraint_factory.h" | 10 #include "content/renderer/media/mock_constraint_factory.h" |
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 auto result = SelectSettings(); | 1962 auto result = SelectSettings(); |
1963 EXPECT_EQ(std::round(480 * 1.32), result.Width()); | 1963 EXPECT_EQ(std::round(480 * 1.32), result.Width()); |
1964 EXPECT_EQ(480, result.Height()); | 1964 EXPECT_EQ(480, result.Height()); |
1965 // Exact aspect ratio prevents the resolution from being adjusted. | 1965 // Exact aspect ratio prevents the resolution from being adjusted. |
1966 EXPECT_EQ(media::RESOLUTION_POLICY_FIXED_RESOLUTION, | 1966 EXPECT_EQ(media::RESOLUTION_POLICY_FIXED_RESOLUTION, |
1967 result.ResolutionChangePolicy()); | 1967 result.ResolutionChangePolicy()); |
1968 EXPECT_EQ(1.32, result.track_adapter_settings().min_aspect_ratio); | 1968 EXPECT_EQ(1.32, result.track_adapter_settings().min_aspect_ratio); |
1969 EXPECT_EQ(1.32, result.track_adapter_settings().max_aspect_ratio); | 1969 EXPECT_EQ(1.32, result.track_adapter_settings().max_aspect_ratio); |
1970 CheckTrackAdapterSettingsEqualsFormat(result); | 1970 CheckTrackAdapterSettingsEqualsFormat(result); |
1971 } | 1971 } |
| 1972 { |
| 1973 constraint_factory_.Reset(); |
| 1974 constraint_factory_.basic().height.SetMax(4000); |
| 1975 constraint_factory_.basic().width.SetMax(4000); |
| 1976 auto result = SelectSettings(); |
| 1977 EXPECT_EQ(4000, result.Width()); |
| 1978 EXPECT_EQ(4000, result.Height()); |
| 1979 // Only specifying a maximum resolution allows resolution adjustment. |
| 1980 EXPECT_EQ(media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT, |
| 1981 result.ResolutionChangePolicy()); |
| 1982 EXPECT_EQ(1.0 / 4000, result.track_adapter_settings().min_aspect_ratio); |
| 1983 EXPECT_EQ(4000.0, result.track_adapter_settings().max_aspect_ratio); |
| 1984 CheckTrackAdapterSettingsEqualsFormat(result); |
| 1985 } |
1972 } | 1986 } |
1973 | 1987 |
1974 } // namespace content | 1988 } // namespace content |
OLD | NEW |