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

Unified Diff: media/cdm/aes_decryptor_unittest.cc

Issue 975983002: Update Clear Key to support keyids formatted init_data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: escape non-ASCII Created 5 years, 10 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
Index: media/cdm/aes_decryptor_unittest.cc
diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc
index ce06fe204c1c09689f5f1070216079f78984cb87..8ca39408511bf87bb7a7e88057ffc0af1c63fb8b 100644
--- a/media/cdm/aes_decryptor_unittest.cc
+++ b/media/cdm/aes_decryptor_unittest.cc
@@ -252,7 +252,8 @@ class AesDecryptorTest : public testing::Test {
MediaKeys::Exception exception_code,
uint32 system_code,
const std::string& error_message) {
- EXPECT_EQ(expected_result, REJECTED) << "Unexpectedly rejected.";
+ EXPECT_EQ(expected_result, REJECTED)
+ << "Unexpectedly rejected with message: " << error_message;
}
scoped_ptr<SimpleCdmPromise> CreatePromise(PromiseResult expected_result) {
@@ -454,6 +455,40 @@ TEST_F(AesDecryptorTest, MultipleCreateSession) {
CreateSessionPromise(RESOLVED));
}
+TEST_F(AesDecryptorTest, CreateSessionWithCencInitData) {
+ const uint8 init_data[] = {
+ 0x00, 0x00, 0x00, 0x44, // size = 68
+ 0x70, 0x73, 0x73, 0x68, // 'pssh'
+ 0x01, // version
+ 0x00, 0x00, 0x00, // flags
+ 0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, // SystemID
+ 0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B,
+ 0x00, 0x00, 0x00, 0x02, // key count
+ 0x7E, 0x57, 0x1D, 0x03, 0x7E, 0x57, 0x1D, 0x03, // key1
+ 0x7E, 0x57, 0x1D, 0x03, 0x7E, 0x57, 0x1D, 0x03,
+ 0x7E, 0x57, 0x1D, 0x04, 0x7E, 0x57, 0x1D, 0x04, // key2
+ 0x7E, 0x57, 0x1D, 0x04, 0x7E, 0x57, 0x1D, 0x04,
+ 0x00, 0x00, 0x00, 0x00 // datasize
+ };
+ EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsJSONDictionary(),
+ GURL::EmptyGURL()));
+ decryptor_.CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, "cenc", init_data, arraysize(init_data),
+ CreateSessionPromise(RESOLVED));
+}
+
+TEST_F(AesDecryptorTest, CreateSessionWithKeyIdsInitData) {
+ const char init_data[] =
+ "{\"kids\":[\"AQI\",\"AQIDBA\",\"AQIDBAUGBwgJCgsMDQ4PEA\"]}";
+
+ EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsJSONDictionary(),
+ GURL::EmptyGURL()));
+ decryptor_.CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, "keyids",
+ reinterpret_cast<const uint8*>(init_data), arraysize(init_data) - 1,
+ CreateSessionPromise(RESOLVED));
+}
+
TEST_F(AesDecryptorTest, NormalDecryption) {
std::string session_id = CreateSession(key_id_);
UpdateSessionAndExpect(session_id, kKeyAsJWK, RESOLVED);
« no previous file with comments | « media/cdm/aes_decryptor.cc ('k') | media/cdm/json_web_key.h » ('j') | media/cdm/json_web_key.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698