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

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

Issue 284183003: Add MediaDrmBridge::AddKeySystemUuidMapping(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed xhwang's comments. Created 6 years, 7 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 a838203304a535ab293ce809db9e208dda49a001..11c257f29c24d5e565394a771fa8faadd7f74a22 100644
--- a/media/base/android/media_drm_bridge_unittest.cc
+++ b/media/base/android/media_drm_bridge_unittest.cc
@@ -26,6 +26,10 @@ const char kVideoMp4[] = "video/mp4";
const char kAudioWebM[] = "audio/webm";
const char kVideoWebM[] = "video/webm";
const char kInvalidKeySystem[] = "invalid.keysystem";
+const char kFooKeySystem[] = "com.foo.keysystem";
+const uint8 kWidevineUuid[16] = {
+ 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
+ 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
const MediaDrmBridge::SecurityLevel kLNone =
MediaDrmBridge::SECURITY_LEVEL_NONE;
const MediaDrmBridge::SecurityLevel kL1 = MediaDrmBridge::SECURITY_LEVEL_1;
@@ -93,4 +97,33 @@ TEST(MediaDrmBridgeTest, IsKeySystemSupported_InvalidKeySystem) {
EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3"));
}
+TEST(MediaDrmBridgeTest, AddNewKeySystemMapping) {
+ EXPECT_FALSE(IsKeySystemSupported(kFooKeySystem));
+
+ // Use WV UUID for foo, because it is the only key system we can guarentee
+ // that it is installed in the test device.
+ std::vector<uint8> foo_uuid(kWidevineUuid,
+ kWidevineUuid + arraysize(kWidevineUuid));
+ MediaDrmBridge::AddKeySystemUuidMapping(kFooKeySystem, foo_uuid);
+
+ EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kFooKeySystem));
+ EXPECT_TRUE_IF_AVAILABLE(
+ IsKeySystemSupportedWithType(kFooKeySystem, kVideoMp4));
+}
+
+TEST(MediaDrmBridgeTest, ShouldNotOverwriteExistingKeySystem) {
+ EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem));
+ std::vector<uint8> invalid_uuid = std::vector<uint8>(16, 99);
+#if DCHECK_IS_ON
+ ASSERT_DEATH({
+ MediaDrmBridge::AddKeySystemUuidMapping(kWidevineKeySystem, invalid_uuid);
+ }, "");
+#else
+ // Try to add WV keysystem with the invalid UUID.
+ MediaDrmBridge::AddKeySystemUuidMapping(kWidevineKeySystem, invalid_uuid);
+
+ EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem));
+#endif
+}
+
} // 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