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 1a4c01426ae76af8ffccf8b644717a4913422656..1855c2cb10ac18ed62a9cdae8777e22c4c321bc0 100644 |
--- a/media/base/android/media_drm_bridge_unittest.cc |
+++ b/media/base/android/media_drm_bridge_unittest.cc |
@@ -34,10 +34,6 @@ 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) { |
@@ -45,29 +41,9 @@ static bool IsKeySystemSupportedWithType( |
container_mime_type); |
} |
-static bool IsSecurityLevelSupported( |
- const std::string& key_system, |
- MediaDrmBridge::SecurityLevel security_level) { |
- return MediaDrmBridge::IsSecurityLevelSupported(key_system, security_level); |
-} |
- |
-TEST(MediaDrmBridgeTest, IsSecurityLevelSupported_Widevine) { |
- EXPECT_FALSE(IsSecurityLevelSupported(kWidevineKeySystem, kLNone)); |
- // We test "L3" fully. But for "L1" we don't check the result as it depends on |
- // whether the test device supports "L1". |
- EXPECT_TRUE_IF_AVAILABLE(IsSecurityLevelSupported(kWidevineKeySystem, kL3)); |
- IsSecurityLevelSupported(kWidevineKeySystem, kL1); |
-} |
- |
-// Invalid keysytem is NOT supported regardless whether MediaDrm is available. |
-TEST(MediaDrmBridgeTest, IsSecurityLevelSupported_InvalidKeySystem) { |
- EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kLNone)); |
- EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kL1)); |
- EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kL3)); |
-} |
- |
TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { |
- EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem)); |
+ EXPECT_TRUE_IF_AVAILABLE( |
+ MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)); |
// TODO(xhwang): Enable when b/13564917 is fixed. |
// EXPECT_TRUE_IF_AVAILABLE( |
@@ -88,9 +64,9 @@ TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { |
EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "audio/mp3")); |
} |
-// Invalid keysytem is NOT supported regardless whether MediaDrm is available. |
+// Invalid key system is NOT supported regardless whether MediaDrm is available. |
TEST(MediaDrmBridgeTest, IsKeySystemSupported_InvalidKeySystem) { |
- EXPECT_FALSE(IsKeySystemSupported(kInvalidKeySystem)); |
+ EXPECT_FALSE(MediaDrmBridge::IsKeySystemSupported(kInvalidKeySystem)); |
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioMp4)); |
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoMp4)); |
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioWebM)); |
@@ -100,4 +76,28 @@ TEST(MediaDrmBridgeTest, IsKeySystemSupported_InvalidKeySystem) { |
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3")); |
} |
+TEST(MediaDrmBridgeTest, CreateWithoutSessionSupport_Widevine) { |
ddorwin
2015/02/18 18:11:50
These two tests are new.
Note: CreateWithoutSessi
|
+ EXPECT_TRUE_IF_AVAILABLE( |
+ MediaDrmBridge::CreateWithoutSessionSupport(kWidevineKeySystem)); |
+} |
+ |
+// Invalid key system is NOT supported regardless whether MediaDrm is available. |
+TEST(MediaDrmBridgeTest, CreateWithoutSessionSupport_InvalidKeySystem) { |
+ EXPECT_FALSE(MediaDrmBridge::CreateWithoutSessionSupport(kInvalidKeySystem)); |
+} |
+ |
+TEST(MediaDrmBridgeTest, SetSecurityLevel_Widevine) { |
ddorwin
2015/02/18 18:11:51
This test covers the only remaining useful part of
|
+ scoped_ptr<MediaDrmBridge> media_drm_bridge = |
+ MediaDrmBridge::CreateWithoutSessionSupport(kWidevineKeySystem); |
+ EXPECT_TRUE_IF_AVAILABLE(media_drm_bridge); |
+ if (!media_drm_bridge) |
+ return; |
+ |
+ EXPECT_FALSE(media_drm_bridge->SetSecurityLevel(kLNone)); |
+ // We test "L3" fully. But for "L1" we don't check the result as it depends on |
+ // whether the test device supports "L1". |
+ EXPECT_TRUE(media_drm_bridge->SetSecurityLevel(kL3)); |
qinmin
2015/02/18 17:53:03
have you tested this on ICS devices?
ddorwin
2015/02/18 18:11:50
ICS devices should exit at line 94, right? This is
qinmin
2015/02/18 21:32:51
I see. Sorry i missed that.
|
+ media_drm_bridge->SetSecurityLevel(kL1); |
+} |
+ |
} // namespace media |