summaryrefslogtreecommitdiffstats
path: root/media/crypto
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 01:14:40 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 01:14:40 +0000
commit6a20673eac5bd4b1c661ed1ee14fc1667adfdfa6 (patch)
tree7d25a291f2ff06564c4e4efa7954c6c9a6c65f78 /media/crypto
parentc68a529d672c1fb10473c2a5b31a27404a369968 (diff)
downloadchromium_src-6a20673eac5bd4b1c661ed1ee14fc1667adfdfa6.zip
chromium_src-6a20673eac5bd4b1c661ed1ee14fc1667adfdfa6.tar.gz
chromium_src-6a20673eac5bd4b1c661ed1ee14fc1667adfdfa6.tar.bz2
Add a bool return value to media::Decryptor::GenerateKeyRequest().
Add a bool return value in media::Decryptor::GenerateKeyRequest() call and add code in WebMeidaPlayerImpl to check this value. If GenerateKeyRequest() fails, prevent further calls to AddKey() and CancelKeyRequest(). BUG=145322 TEST=Called AddKey() after GenerateKeyRequest() fails and no crash. Review URL: https://chromiumcodereview.appspot.com/10896014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/crypto')
-rw-r--r--media/crypto/aes_decryptor.cc3
-rw-r--r--media/crypto/aes_decryptor.h2
-rw-r--r--media/crypto/aes_decryptor_unittest.cc3
3 files changed, 5 insertions, 3 deletions
diff --git a/media/crypto/aes_decryptor.cc b/media/crypto/aes_decryptor.cc
index bbeab8c..777d79f 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -195,7 +195,7 @@ AesDecryptor::~AesDecryptor() {
STLDeleteValues(&key_map_);
}
-void AesDecryptor::GenerateKeyRequest(const std::string& key_system,
+bool AesDecryptor::GenerateKeyRequest(const std::string& key_system,
const uint8* init_data,
int init_data_length) {
std::string session_id_string(base::UintToString(next_session_id_++));
@@ -207,6 +207,7 @@ void AesDecryptor::GenerateKeyRequest(const std::string& key_system,
client_->KeyMessage(key_system, session_id_string,
message.Pass(), message_length, "");
+ return true;
}
void AesDecryptor::AddKey(const std::string& key_system,
diff --git a/media/crypto/aes_decryptor.h b/media/crypto/aes_decryptor.h
index 0c96efc..d86d4bc 100644
--- a/media/crypto/aes_decryptor.h
+++ b/media/crypto/aes_decryptor.h
@@ -35,7 +35,7 @@ class MEDIA_EXPORT AesDecryptor : public Decryptor {
virtual ~AesDecryptor();
// Decryptor implementation.
- virtual void GenerateKeyRequest(const std::string& key_system,
+ virtual bool GenerateKeyRequest(const std::string& key_system,
const uint8* init_data,
int init_data_length) OVERRIDE;
virtual void AddKey(const std::string& key_system,
diff --git a/media/crypto/aes_decryptor_unittest.cc b/media/crypto/aes_decryptor_unittest.cc
index 373dd4b..95472f1 100644
--- a/media/crypto/aes_decryptor_unittest.cc
+++ b/media/crypto/aes_decryptor_unittest.cc
@@ -256,7 +256,8 @@ class AesDecryptorTest : public testing::Test {
EXPECT_CALL(client_, KeyMessageMock(kClearKeySystem, StrNe(std::string()),
NotNull(), Gt(0), ""))
.WillOnce(SaveArg<1>(&session_id_string_));
- decryptor_.GenerateKeyRequest(kClearKeySystem, key_id, key_id_size);
+ EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem,
+ key_id, key_id_size));
}
void AddKeyAndExpectToSucceed(const uint8* key_id, int key_id_size,