| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally | 5 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally |
| 6 // shorten and improve coverage. | 6 // shorten and improve coverage. |
| 7 // - http://crbug.com/417444 | 7 // - http://crbug.com/417444 |
| 8 // - http://crbug.com/457438 | 8 // - http://crbug.com/457438 |
| 9 // TODO(sandersd): Add tests to cover codec vectors with empty items. | 9 // TODO(sandersd): Add tests to cover codec vectors with empty items. |
| 10 // http://crbug.com/417461 | 10 // http://crbug.com/417461 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE, | 71 static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE, |
| 72 "test codec masks should only use invalid codec masks"); | 72 "test codec masks should only use invalid codec masks"); |
| 73 | 73 |
| 74 // Adapt IsSupportedKeySystemWithMediaMimeType() to the new API, | 74 // Adapt IsSupportedKeySystemWithMediaMimeType() to the new API, |
| 75 // IsSupportedCodecCombination(). | 75 // IsSupportedCodecCombination(). |
| 76 static bool IsSupportedKeySystemWithMediaMimeType( | 76 static bool IsSupportedKeySystemWithMediaMimeType( |
| 77 const std::string& mime_type, | 77 const std::string& mime_type, |
| 78 const std::vector<std::string>& codecs, | 78 const std::vector<std::string>& codecs, |
| 79 const std::string& key_system) { | 79 const std::string& key_system) { |
| 80 return KeySystems::GetInstance()->IsSupportedCodecCombination( | 80 return (KeySystems::GetInstance()->GetContentTypeConfigRule( |
| 81 key_system, EmeMediaType::VIDEO, mime_type, codecs); | 81 key_system, EmeMediaType::VIDEO, mime_type, codecs) != |
| 82 EmeConfigRule::NOT_SUPPORTED); |
| 82 } | 83 } |
| 83 | 84 |
| 84 static bool IsSupportedKeySystemWithAudioMimeType( | 85 static bool IsSupportedKeySystemWithAudioMimeType( |
| 85 const std::string& mime_type, | 86 const std::string& mime_type, |
| 86 const std::vector<std::string>& codecs, | 87 const std::vector<std::string>& codecs, |
| 87 const std::string& key_system) { | 88 const std::string& key_system) { |
| 88 return KeySystems::GetInstance()->IsSupportedCodecCombination( | 89 return (KeySystems::GetInstance()->GetContentTypeConfigRule( |
| 89 key_system, EmeMediaType::AUDIO, mime_type, codecs); | 90 key_system, EmeMediaType::AUDIO, mime_type, codecs) != |
| 91 EmeConfigRule::NOT_SUPPORTED); |
| 90 } | 92 } |
| 91 | 93 |
| 92 // Adds test container and codec masks. | 94 // Adds test container and codec masks. |
| 93 // This function must be called after SetMediaClient() if a MediaClient will be | 95 // This function must be called after SetMediaClient() if a MediaClient will be |
| 94 // provided. | 96 // provided. |
| 95 // More details: AddXxxMask() will create KeySystems if it hasn't been created. | 97 // More details: AddXxxMask() will create KeySystems if it hasn't been created. |
| 96 // During KeySystems's construction GetMediaClient() will be used to add key | 98 // During KeySystems's construction GetMediaClient() will be used to add key |
| 97 // systems. In test code, the MediaClient is set by SetMediaClient(). | 99 // systems. In test code, the MediaClient is set by SetMediaClient(). |
| 98 // Therefore, SetMediaClient() must be called before this function to make sure | 100 // Therefore, SetMediaClient() must be called before this function to make sure |
| 99 // MediaClient in effect when constructing KeySystems. | 101 // MediaClient in effect when constructing KeySystems. |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); | 840 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); |
| 839 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); | 841 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); |
| 840 | 842 |
| 841 EXPECT_FALSE(IsSupportedKeySystem("x-")); | 843 EXPECT_FALSE(IsSupportedKeySystem("x-")); |
| 842 EXPECT_TRUE(IsSupportedKeySystem("x-something")); | 844 EXPECT_TRUE(IsSupportedKeySystem("x-something")); |
| 843 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); | 845 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); |
| 844 EXPECT_FALSE(IsSupportedKeySystem("x-other")); | 846 EXPECT_FALSE(IsSupportedKeySystem("x-other")); |
| 845 } | 847 } |
| 846 | 848 |
| 847 } // namespace media | 849 } // namespace media |
| OLD | NEW |