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

Unified Diff: chromecast/media/cdm/chromecast_init_data_unittest.cc

Issue 1168153003: Chromecast PSSH boxes must use data_size parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: chromecast/media/cdm/chromecast_init_data_unittest.cc
diff --git a/chromecast/media/cdm/chromecast_init_data_unittest.cc b/chromecast/media/cdm/chromecast_init_data_unittest.cc
index 763d7975bb4566e9af2fdb022407d90a702ab013..8a4ad32546d87b111a1d3de319ee58b95e0186c5 100644
--- a/chromecast/media/cdm/chromecast_init_data_unittest.cc
+++ b/chromecast/media/cdm/chromecast_init_data_unittest.cc
@@ -62,11 +62,12 @@ TEST(ChromecastInitDataTest, TestUuidAfterPssh) {
TEST(ChromecastInitDataTest, TestPsshCustomData) {
const uint8_t kInitDataBlob[] = {
- 0x00, 0x00, 0x00, 0x2E, // length
+ 0x00, 0x00, 0x00, 0x32, // length
0x70, 0x73, 0x73, 0x68, // 'pssh'
0x00, 0x00, 0x00, 0x00, // version / flags
0x2B, 0xF8, 0x66, 0x80, 0xC6, 0xE5, 0x4E, 0x24, 0xBE,
0x23, 0x0F, 0x81, 0x5A, 0x60, 0x6E, 0xB2, // UUID
+ 0x00, 0x00, 0x00, 0x12, // data size
0x00, 0x01, // message type (CUSTOM_DATA)
0x54, 0x65, 0x73, 0x74, 0x20, 0x63, 0x75, 0x73, 0x74,
0x6F, 0x6D, 0x20, 0x64, 0x61, 0x74, 0x61 // 'Test custom data'
@@ -84,13 +85,34 @@ TEST(ChromecastInitDataTest, TestPsshCustomData) {
std::string(init_data.data.begin(), init_data.data.end()));
}
+TEST(ChromecastInitDataTest, TestPsshCustomData_NoSize) {
+ const uint8_t kInitDataBlob[] = {
+ 0x00, 0x00, 0x00, 0x2E, // length
+ 0x70, 0x73, 0x73, 0x68, // 'pssh'
+ 0x00, 0x00, 0x00, 0x00, // version / flags
+ 0x2B, 0xF8, 0x66, 0x80, 0xC6, 0xE5, 0x4E, 0x24, 0xBE,
+ 0x23, 0x0F, 0x81, 0x5A, 0x60, 0x6E, 0xB2, // UUID
+ // [missing size should be present here].
+ 0x00, 0x01, // message type (CUSTOM_DATA)
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x63, 0x75, 0x73, 0x74,
+ 0x6F, 0x6D, 0x20, 0x64, 0x61, 0x74, 0x61 // 'Test custom data'
+ };
+
+ ChromecastInitData init_data;
+ EXPECT_FALSE(FindChromecastInitData(
+ std::vector<uint8_t>(kInitDataBlob,
+ kInitDataBlob + sizeof(kInitDataBlob)),
+ InitDataMessageType::CUSTOM_DATA, &init_data));
+}
+
TEST(ChromecastInitDataTest, TestPsshSecureStop) {
const uint8_t kInitDataBlob[] = {
- 0x00, 0x00, 0x00, 0x1E, // length
+ 0x00, 0x00, 0x00, 0x22, // length
0x70, 0x73, 0x73, 0x68, // 'pssh'
0x00, 0x00, 0x00, 0x00, // version / flags
0x2B, 0xF8, 0x66, 0x80, 0xC6, 0xE5, 0x4E, 0x24,
0xBE, 0x23, 0x0F, 0x81, 0x5A, 0x60, 0x6E, 0xB2, // UUID
+ 0x00, 0x00, 0x00, 0x02, // data size
0x00, 0x02, // message type (ENABLE_SECURE_STOP)
};
@@ -104,5 +126,23 @@ TEST(ChromecastInitDataTest, TestPsshSecureStop) {
EXPECT_EQ(0u, init_data.data.size());
}
+TEST(ChromecastInitDataTest, TestPsshSecureStop_NoSize) {
+ const uint8_t kInitDataBlob[] = {
+ 0x00, 0x00, 0x00, 0x1E, // length
+ 0x70, 0x73, 0x73, 0x68, // 'pssh'
+ 0x00, 0x00, 0x00, 0x00, // version / flags
+ 0x2B, 0xF8, 0x66, 0x80, 0xC6, 0xE5, 0x4E, 0x24,
+ 0xBE, 0x23, 0x0F, 0x81, 0x5A, 0x60, 0x6E, 0xB2, // UUID
+ // [missing size should be present here].
+ 0x00, 0x02, // message type (ENABLE_SECURE_STOP)
+ };
+
+ ChromecastInitData init_data;
+ EXPECT_FALSE(FindChromecastInitData(
+ std::vector<uint8_t>(kInitDataBlob,
+ kInitDataBlob + sizeof(kInitDataBlob)),
+ InitDataMessageType::ENABLE_SECURE_STOP, &init_data));
+}
+
} // namespace media
} // namespace chromecast
« chromecast/media/cdm/chromecast_init_data.cc ('K') | « chromecast/media/cdm/chromecast_init_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698