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

Unified Diff: media/base/android/media_drm_bridge_unittest.cc

Issue 230843004: Reland r262568 "Encrypted Media: Check container mime type in MediaDrmBridge". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_drm_bridge.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_drm_bridge_unittest.cc
diff --git a/media/base/android/media_drm_bridge_unittest.cc b/media/base/android/media_drm_bridge_unittest.cc
index fdf5350ed31eedb4c38aa08f45a32c84ec4e1c0a..a838203304a535ab293ce809db9e208dda49a001 100644
--- a/media/base/android/media_drm_bridge_unittest.cc
+++ b/media/base/android/media_drm_bridge_unittest.cc
@@ -31,6 +31,12 @@ const MediaDrmBridge::SecurityLevel kLNone =
const MediaDrmBridge::SecurityLevel kL1 = MediaDrmBridge::SECURITY_LEVEL_1;
const MediaDrmBridge::SecurityLevel kL3 = MediaDrmBridge::SECURITY_LEVEL_3;
+// Helper functions to avoid typing "MediaDrmBridge::" in tests.
+
+static bool IsKeySystemSupported(const std::string& key_system) {
+ return MediaDrmBridge::IsKeySystemSupported(key_system);
+}
+
static bool IsKeySystemSupportedWithType(
const std::string& key_system,
const std::string& container_mime_type) {
@@ -59,26 +65,32 @@ TEST(MediaDrmBridgeTest, IsSecurityLevelSupported_InvalidKeySystem) {
EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kL3));
}
-TEST(MediaDrmBridgeTest, IsTypeSupported_Widevine) {
- EXPECT_TRUE_IF_AVAILABLE(
- IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioMp4));
+TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) {
+ EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem));
+
+ // TODO(xhwang): Enable when b/13564917 is fixed.
+ // EXPECT_TRUE_IF_AVAILABLE(
+ // IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioMp4));
EXPECT_TRUE_IF_AVAILABLE(
IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4));
- // TODO(xhwang): MediaDrmBridge.IsKeySystemSupportedWithType() doesn't check
- // the container type. Fix IsKeySystemSupportedWithType() and update this test
- // as necessary. See: http://crbug.com/350481
- EXPECT_TRUE_IF_AVAILABLE(
- IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM));
- EXPECT_TRUE_IF_AVAILABLE(
- IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "unknown"));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "video/avi"));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "audio/mp3"));
}
// Invalid keysytem is NOT supported regardless whether MediaDrm is available.
-TEST(MediaDrmBridgeTest, IsTypeSupported_InvalidKeySystem) {
- EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, ""));
+TEST(MediaDrmBridgeTest, IsKeySystemSupported_InvalidKeySystem) {
+ EXPECT_FALSE(IsKeySystemSupported(kInvalidKeySystem));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioMp4));
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoMp4));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioWebM));
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoWebM));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "unknown"));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "video/avi"));
+ EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3"));
}
} // namespace media
« no previous file with comments | « media/base/android/media_drm_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698