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

Unified Diff: media/cdm/aes_decryptor_unittest.cc

Issue 427993002: Implement ClearKey message format as JSON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « media/cdm/aes_decryptor.cc ('k') | media/cdm/json_web_key.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/aes_decryptor_unittest.cc
diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc
index 91cd6ac365d39f844b8883861149494b1d7ffffd..fe84c07521b956bc7ebeebf67c76bf91a87299a8 100644
--- a/media/cdm/aes_decryptor_unittest.cc
+++ b/media/cdm/aes_decryptor_unittest.cc
@@ -7,6 +7,8 @@
#include "base/basictypes.h"
#include "base/bind.h"
+#include "base/json/json_reader.h"
+#include "base/values.h"
#include "media/base/cdm_promise.h"
#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
@@ -24,6 +26,11 @@ using ::testing::StrNe;
MATCHER(IsEmpty, "") { return arg.empty(); }
MATCHER(IsNotEmpty, "") { return !arg.empty(); }
+MATCHER(IsJSONDictionary, "") {
+ std::string result(arg.begin(), arg.end());
+ scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(result));
+ return (root.get() && root->GetType() == base::Value::TYPE_DICTIONARY);
+}
class GURL;
@@ -51,7 +58,8 @@ const char kKeyAsJWK[] =
" \"kid\": \"AAECAw\","
" \"k\": \"BAUGBwgJCgsMDQ4PEBESEw\""
" }"
- " ]"
+ " ],"
+ " \"type\": \"temporary\""
"}";
// Same kid as kKeyAsJWK, key to decrypt kEncryptedData2
@@ -287,7 +295,8 @@ class AesDecryptorTest : public testing::Test {
std::string CreateSession(const std::vector<uint8>& key_id) {
DCHECK(!key_id.empty());
EXPECT_CALL(*this,
- OnSessionMessage(IsNotEmpty(), key_id, GURL::EmptyGURL()));
+ OnSessionMessage(
+ IsNotEmpty(), IsJSONDictionary(), GURL::EmptyGURL()));
decryptor_.CreateSession(std::string(),
&key_id[0],
key_id.size(),
« no previous file with comments | « media/cdm/aes_decryptor.cc ('k') | media/cdm/json_web_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698