| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/base/decrypt_config.h" | 9 #include "media/base/decrypt_config.h" |
| 10 #include "media/webm/cluster_builder.h" | 10 #include "media/webm/cluster_builder.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 kVideoTrackNum, | 518 kVideoTrackNum, |
| 519 WebMTracksParser::TextTracks(), | 519 WebMTracksParser::TextTracks(), |
| 520 std::set<int64>(), | 520 std::set<int64>(), |
| 521 std::string(), | 521 std::string(), |
| 522 "video_key_id", | 522 "video_key_id", |
| 523 LogCB())); | 523 LogCB())); |
| 524 int result = parser_->Parse(cluster->data(), cluster->size()); | 524 int result = parser_->Parse(cluster->data(), cluster->size()); |
| 525 EXPECT_EQ(-1, result); | 525 EXPECT_EQ(-1, result); |
| 526 } | 526 } |
| 527 | 527 |
| 528 TEST_F(WebMClusterParserTest, ParseInvalidZeroSizedCluster) { |
| 529 const uint8 kBuffer[] = { |
| 530 0x1F, 0x43, 0xB6, 0x75, 0x80, // CLUSTER (size = 0) |
| 531 }; |
| 532 |
| 533 EXPECT_EQ(parser_->Parse(kBuffer, sizeof(kBuffer)), -1); |
| 534 } |
| 535 |
| 536 TEST_F(WebMClusterParserTest, ParseInvalidUnknownButActuallyZeroSizedCluster) { |
| 537 const uint8 kBuffer[] = { |
| 538 0x1F, 0x43, 0xB6, 0x75, 0xFF, // CLUSTER (size = "unknown") |
| 539 0x1F, 0x43, 0xB6, 0x75, 0x85, // CLUSTER (size = 5) |
| 540 }; |
| 541 |
| 542 EXPECT_EQ(parser_->Parse(kBuffer, sizeof(kBuffer)), -1); |
| 543 } |
| 544 |
| 528 } // namespace media | 545 } // namespace media |
| OLD | NEW |