Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/cdm/cenc_utils.h" | 5 #include "media/cdm/cenc_utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 | 505 |
| 506 std::vector<uint8_t> box2 = MakePSSHBox(0); | 506 std::vector<uint8_t> box2 = MakePSSHBox(0); |
| 507 std::vector<uint8_t> data2(data2_bytes, data2_bytes + arraysize(data2_bytes)); | 507 std::vector<uint8_t> data2(data2_bytes, data2_bytes + arraysize(data2_bytes)); |
| 508 AppendData(box2, data2); | 508 AppendData(box2, data2); |
| 509 | 509 |
| 510 box1.insert(box1.end(), box2.begin(), box2.end()); | 510 box1.insert(box1.end(), box2.begin(), box2.end()); |
| 511 EXPECT_TRUE(GetPsshData(box1, CommonSystemSystemId(), &pssh_data)); | 511 EXPECT_TRUE(GetPsshData(box1, CommonSystemSystemId(), &pssh_data)); |
| 512 EXPECT_EQ(data1, pssh_data); | 512 EXPECT_EQ(data1, pssh_data); |
| 513 EXPECT_NE(data2, pssh_data); | 513 EXPECT_NE(data2, pssh_data); |
| 514 } | 514 } |
| 515 | |
| 516 TEST_F(CencUtilsTest, NonPsshData) { | |
| 517 const uint8_t data[] = { | |
| 518 0x00, 0x00, 0x00, 0x08, // size = 8 | |
| 519 'f', 'r', 'e', 'e' | |
|
ddorwin
2015/06/25 23:08:17
Perhaps p s s g, to ensure all bytes are being che
jrummell
2015/06/30 00:06:03
Done.
| |
| 520 }; | |
| 521 std::vector<uint8_t> free_box(data, data + arraysize(data)); | |
| 522 EXPECT_FALSE(ValidatePsshInput(free_box)); | |
| 523 | |
| 524 // Make a valid 'pssh' box. | |
| 525 std::vector<uint8_t> pssh_box = MakePSSHBox(1, Key1()); | |
| 526 EXPECT_TRUE(ValidatePsshInput(pssh_box)); | |
| 527 | |
| 528 // Concatentate the boxes together (|pssh_box| first). | |
| 529 std::vector<uint8_t> boxes; | |
| 530 boxes.insert(boxes.end(), pssh_box.begin(), pssh_box.end()); | |
| 531 boxes.insert(boxes.end(), free_box.begin(), free_box.end()); | |
| 532 EXPECT_FALSE(ValidatePsshInput(boxes)); | |
| 533 | |
| 534 // Repeat with |free_box| first. | |
| 535 boxes.clear(); | |
| 536 boxes.insert(boxes.end(), free_box.begin(), free_box.end()); | |
| 537 boxes.insert(boxes.end(), pssh_box.begin(), pssh_box.end()); | |
| 538 EXPECT_FALSE(ValidatePsshInput(boxes)); | |
| 539 } | |
| 540 | |
| 515 } // namespace media | 541 } // namespace media |
| OLD | NEW |