| 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 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace mp4 { | 25 namespace mp4 { |
| 26 | 26 |
| 27 class MP4StreamParserTest : public testing::Test { | 27 class MP4StreamParserTest : public testing::Test { |
| 28 public: | 28 public: |
| 29 MP4StreamParserTest() : parser_(new MP4StreamParser) {} | 29 MP4StreamParserTest() : parser_(new MP4StreamParser) {} |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 scoped_ptr<MP4StreamParser> parser_; | 32 scoped_ptr<MP4StreamParser> parser_; |
| 33 | 33 |
| 34 bool AppendData(const uint8* data, size_t length) { | 34 bool AppendData(const uint8* data, size_t length) { |
| 35 parser_->Parse(data, length); | 35 return parser_->Parse(data, length); |
| 36 return true; | |
| 37 } | 36 } |
| 38 | 37 |
| 39 bool AppendDataInPieces(const uint8* data, size_t length) { | 38 bool AppendDataInPieces(const uint8* data, size_t length) { |
| 40 return AppendDataInPieces(data, length, 7); | 39 return AppendDataInPieces(data, length, 7); |
| 41 } | 40 } |
| 42 | 41 |
| 43 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { | 42 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { |
| 44 const uint8* start = data; | 43 const uint8* start = data; |
| 45 const uint8* end = data + length; | 44 const uint8* end = data + length; |
| 46 while (start < end) { | 45 while (start < end) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 InitializeParser(); | 98 InitializeParser(); |
| 100 | 99 |
| 101 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); | 100 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); |
| 102 EXPECT_TRUE(AppendDataInPieces(buffer->GetData(), | 101 EXPECT_TRUE(AppendDataInPieces(buffer->GetData(), |
| 103 buffer->GetDataSize(), | 102 buffer->GetDataSize(), |
| 104 512)); | 103 512)); |
| 105 return true; | 104 return true; |
| 106 } | 105 } |
| 107 }; | 106 }; |
| 108 | 107 |
| 109 TEST_F(MP4StreamParserTest, TestParseBearDASH) { | 108 TEST_F(MP4StreamParserTest, ParseBearDASH) { |
| 110 ParseMP4File("bear.1280x720_dash.mp4"); | 109 ParseMP4File("bear.1280x720_dash.mp4"); |
| 111 } | 110 } |
| 112 | 111 |
| 113 } // namespace mp4 | 112 } // namespace mp4 |
| 114 } // namespace media | 113 } // namespace media |
| OLD | NEW |