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

Unified Diff: media/cdm/aes_decryptor_unittest.cc

Issue 1920433003: EME: Address TODOs related to the removal of prefixed EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 4 years, 4 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 246092ae1107b36f2b82d4ebe6a59946d682d568..34a31d63580d72fbcf145587b6011a64c5c2ea67 100644
--- a/media/cdm/aes_decryptor_unittest.cc
+++ b/media/cdm/aes_decryptor_unittest.cc
@@ -341,19 +341,9 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> {
cdm_->CloseSession(session_id, CreatePromise(RESOLVED));
}
- // Removes the session specified by |session_id|. This should simply do a
- // CloseSession().
- // TODO(jrummell): Clean this up when the prefixed API is removed.
- // http://crbug.com/249976.
+ // Only persistent sessions can be removed.
void RemoveSession(const std::string& session_id) {
- if (GetParam() == "AesDecryptor") {
- EXPECT_CALL(*this, OnSessionClosed(session_id));
- EXPECT_CALL(*this, OnSessionKeysChangeCalled(session_id, false));
- cdm_->RemoveSession(session_id, CreatePromise(RESOLVED));
- } else {
- // CdmAdapter fails as only persistent sessions can be removed.
- cdm_->RemoveSession(session_id, CreatePromise(REJECTED));
- }
+ cdm_->RemoveSession(session_id, CreatePromise(REJECTED));
}
MOCK_METHOD2(OnSessionKeysChangeCalled,
@@ -500,32 +490,59 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> {
const std::vector<SubsampleEntry> no_subsample_entries_;
};
-TEST_P(AesDecryptorTest, CreateSessionWithNullInitData) {
- EXPECT_CALL(*this,
- OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL()));
+TEST_P(AesDecryptorTest, CreateSessionWithEmptyInitData) {
cdm_->CreateSessionAndGenerateRequest(
MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
- std::vector<uint8_t>(), CreateSessionPromise(RESOLVED));
+ std::vector<uint8_t>(), CreateSessionPromise(REJECTED));
+ cdm_->CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, EmeInitDataType::CENC,
+ std::vector<uint8_t>(), CreateSessionPromise(REJECTED));
+ cdm_->CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, EmeInitDataType::KEYIDS,
+ std::vector<uint8_t>(), CreateSessionPromise(REJECTED));
+}
+
+TEST_P(AesDecryptorTest, CreateSessionWithVariousLengthInitData_WebM) {
+ std::vector<uint8_t> init_data;
+ init_data.resize(1);
+ cdm_->CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
+ std::vector<uint8_t>(init_data), CreateSessionPromise(RESOLVED));
+
+ init_data.resize(16); // The expected size.
+ cdm_->CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
+ std::vector<uint8_t>(init_data), CreateSessionPromise(RESOLVED));
+
+ init_data.resize(512);
+ cdm_->CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
+ std::vector<uint8_t>(init_data), CreateSessionPromise(RESOLVED));
+
+ init_data.resize(513);
+ cdm_->CreateSessionAndGenerateRequest(
+ MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
+ std::vector<uint8_t>(init_data), CreateSessionPromise(REJECTED));
}
TEST_P(AesDecryptorTest, MultipleCreateSession) {
- EXPECT_CALL(*this,
- OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL()));
+ EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsNotEmpty(),
+ GURL::EmptyGURL()));
cdm_->CreateSessionAndGenerateRequest(
MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
- std::vector<uint8_t>(), CreateSessionPromise(RESOLVED));
+ std::vector<uint8_t>(1), CreateSessionPromise(RESOLVED));
- EXPECT_CALL(*this,
- OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL()));
+ EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsNotEmpty(),
+ GURL::EmptyGURL()));
cdm_->CreateSessionAndGenerateRequest(
MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
- std::vector<uint8_t>(), CreateSessionPromise(RESOLVED));
+ std::vector<uint8_t>(1), CreateSessionPromise(RESOLVED));
- EXPECT_CALL(*this,
- OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL()));
+ EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsNotEmpty(),
+ GURL::EmptyGURL()));
cdm_->CreateSessionAndGenerateRequest(
MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
- std::vector<uint8_t>(), CreateSessionPromise(RESOLVED));
+ std::vector<uint8_t>(1), CreateSessionPromise(RESOLVED));
}
TEST_P(AesDecryptorTest, CreateSessionWithCencInitData) {
@@ -768,9 +785,8 @@ TEST_P(AesDecryptorTest, CloseSession) {
CloseSession(session_id);
}
-TEST_P(AesDecryptorTest, RemoveSession) {
- // TODO(jrummell): Clean this up when the prefixed API is removed.
- // http://crbug.com/249976.
+// Re-enable if https://crbug.com/416194 is fixed.
+TEST_P(AesDecryptorTest, RemoveSession_DISABLED) {
std::string session_id = CreateSession(key_id_);
scoped_refptr<DecoderBuffer> encrypted_buffer = CreateEncryptedBuffer(
encrypted_data_, key_id_, iv_, no_subsample_entries_);

Powered by Google App Engine
This is Rietveld 408576698