OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 #if defined(OS_ANDROID) | 104 #if defined(OS_ANDROID) |
105 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | 105 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
106 #else | 106 #else |
107 return true; | 107 return true; |
108 #endif // defined(OS_ANDROID) | 108 #endif // defined(OS_ANDROID) |
109 #else | 109 #else |
110 return false; | 110 return false; |
111 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) | 111 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) |
112 } | 112 } |
113 | 113 |
| 114 // This is to validate MimeUtil::IsCodecSupportedOnPlatform(), which is used |
| 115 // only on Android platform. |
| 116 static bool HasDolbyVisionSupport() { |
| 117 return false; |
| 118 } |
| 119 |
114 TEST(MimeUtilTest, CommonMediaMimeType) { | 120 TEST(MimeUtilTest, CommonMediaMimeType) { |
115 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); | 121 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); |
116 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); | 122 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); |
117 | 123 |
118 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); | 124 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); |
119 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); | 125 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); |
120 | 126 |
121 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac")); | 127 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac")); |
122 | 128 |
123 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); | 129 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 EXPECT_EQ(info.has_platform_vp8_decoder, result); | 282 EXPECT_EQ(info.has_platform_vp8_decoder, result); |
277 break; | 283 break; |
278 | 284 |
279 case MimeUtil::VP9: | 285 case MimeUtil::VP9: |
280 EXPECT_EQ(info.has_platform_vp9_decoder, result); | 286 EXPECT_EQ(info.has_platform_vp9_decoder, result); |
281 break; | 287 break; |
282 | 288 |
283 case MimeUtil::HEVC: | 289 case MimeUtil::HEVC: |
284 EXPECT_EQ(HasHevcSupport(), result); | 290 EXPECT_EQ(HasHevcSupport(), result); |
285 break; | 291 break; |
| 292 |
| 293 case MimeUtil::DOLBY_VISION: |
| 294 EXPECT_EQ(HasDolbyVisionSupport(), result); |
| 295 break; |
286 } | 296 } |
287 }); | 297 }); |
288 } | 298 } |
289 | 299 |
290 TEST(IsCodecSupportedOnAndroidTest, ClearCodecBehavior) { | 300 TEST(IsCodecSupportedOnAndroidTest, ClearCodecBehavior) { |
291 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); | 301 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); |
292 | 302 |
293 MimeUtil::PlatformInfo test_states; | 303 MimeUtil::PlatformInfo test_states; |
294 | 304 |
295 RunCodecSupportTest( | 305 RunCodecSupportTest( |
(...skipping 24 matching lines...) Expand all Loading... |
320 break; | 330 break; |
321 | 331 |
322 // These codecs are only supported if platform decoders are supported. | 332 // These codecs are only supported if platform decoders are supported. |
323 case MimeUtil::H264: | 333 case MimeUtil::H264: |
324 EXPECT_EQ(info.has_platform_decoders, result); | 334 EXPECT_EQ(info.has_platform_decoders, result); |
325 break; | 335 break; |
326 | 336 |
327 case MimeUtil::HEVC: | 337 case MimeUtil::HEVC: |
328 EXPECT_EQ(HasHevcSupport() && info.has_platform_decoders, result); | 338 EXPECT_EQ(HasHevcSupport() && info.has_platform_decoders, result); |
329 break; | 339 break; |
| 340 |
| 341 case MimeUtil::DOLBY_VISION: |
| 342 EXPECT_EQ(HasDolbyVisionSupport(), result); |
| 343 break; |
330 } | 344 } |
331 }); | 345 }); |
332 } | 346 } |
333 | 347 |
334 TEST(IsCodecSupportedOnAndroidTest, OpusOggSupport) { | 348 TEST(IsCodecSupportedOnAndroidTest, OpusOggSupport) { |
335 // Vary all parameters; thus use default initial state. | 349 // Vary all parameters; thus use default initial state. |
336 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); | 350 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); |
337 MimeUtil::PlatformInfo test_states; | 351 MimeUtil::PlatformInfo test_states; |
338 | 352 |
339 RunCodecSupportTest( | 353 RunCodecSupportTest( |
(...skipping 18 matching lines...) Expand all Loading... |
358 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); | 372 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); |
359 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( | 373 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( |
360 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); | 374 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); |
361 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( | 375 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( |
362 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); | 376 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); |
363 }); | 377 }); |
364 } | 378 } |
365 | 379 |
366 } // namespace internal | 380 } // namespace internal |
367 } // namespace media | 381 } // namespace media |
OLD | NEW |