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 "base/test/scoped_command_line.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "media/base/media.h" |
| 13 #include "media/base/media_switches.h" |
11 #include "media/base/mime_util.h" | 14 #include "media/base/mime_util.h" |
12 #include "media/base/mime_util_internal.h" | 15 #include "media/base/mime_util_internal.h" |
13 #include "media/media_features.h" | 16 #include "media/media_features.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
15 | 18 |
16 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
17 #include "base/android/build_info.h" | 20 #include "base/android/build_info.h" |
18 #endif | 21 #endif |
19 | 22 |
20 namespace media { | 23 namespace media { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 215 } |
213 | 216 |
214 // Test without stripping the codec type. | 217 // Test without stripping the codec type. |
215 std::vector<std::string> codecs_out; | 218 std::vector<std::string> codecs_out; |
216 SplitCodecsToVector("avc1.42E01E, mp4a.40.2", &codecs_out, false); | 219 SplitCodecsToVector("avc1.42E01E, mp4a.40.2", &codecs_out, false); |
217 ASSERT_EQ(2u, codecs_out.size()); | 220 ASSERT_EQ(2u, codecs_out.size()); |
218 EXPECT_EQ("avc1.42E01E", codecs_out[0]); | 221 EXPECT_EQ("avc1.42E01E", codecs_out[0]); |
219 EXPECT_EQ("mp4a.40.2", codecs_out[1]); | 222 EXPECT_EQ("mp4a.40.2", codecs_out[1]); |
220 } | 223 } |
221 | 224 |
| 225 // See deeper string parsing testing in video_codecs_unittests.cc. |
| 226 TEST(MimeUtilTest, ExperimentalMultiPartVp9) { |
| 227 base::test::ScopedCommandLine scoped_command_line; |
| 228 |
| 229 // Multi-part VP9 string not enabled by default. |
| 230 EXPECT_FALSE(IsSupportedMediaFormat("video/webm", {"vp09.00.01.08"})); |
| 231 |
| 232 // Should work if enabled. |
| 233 EnableNewVp9CodecStringSupport(); |
| 234 EXPECT_TRUE(IsSupportedMediaFormat("video/webm", {"vp09.00.01.08"})); |
| 235 } |
| 236 |
222 TEST(IsCodecSupportedOnAndroidTest, EncryptedCodecsFailWithoutPlatformSupport) { | 237 TEST(IsCodecSupportedOnAndroidTest, EncryptedCodecsFailWithoutPlatformSupport) { |
223 // Vary all parameters except |has_platform_decoders|. | 238 // Vary all parameters except |has_platform_decoders|. |
224 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); | 239 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); |
225 states_to_vary.has_platform_decoders = false; | 240 states_to_vary.has_platform_decoders = false; |
226 | 241 |
227 // Disable platform decoders. | 242 // Disable platform decoders. |
228 MimeUtil::PlatformInfo test_states; | 243 MimeUtil::PlatformInfo test_states; |
229 test_states.has_platform_decoders = false; | 244 test_states.has_platform_decoders = false; |
230 | 245 |
231 // Every codec should fail since platform support is missing and we've | 246 // Every codec should fail since platform support is missing and we've |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); | 387 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); |
373 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( | 388 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( |
374 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); | 389 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); |
375 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( | 390 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( |
376 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); | 391 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); |
377 }); | 392 }); |
378 } | 393 } |
379 | 394 |
380 } // namespace internal | 395 } // namespace internal |
381 } // namespace media | 396 } // namespace media |
OLD | NEW |