| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "media/base/mock_media_log.h" | 9 #include "media/base/mock_media_log.h" |
| 10 #include "media/formats/mp4/aac.h" | 10 #include "media/formats/mp4/aac.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 MATCHER_P(UnsupportedAudioProfileLog, profile_string, "") { | 44 MATCHER_P(UnsupportedAudioProfileLog, profile_string, "") { |
| 45 return CONTAINS_STRING( | 45 return CONTAINS_STRING( |
| 46 arg, | 46 arg, |
| 47 "Audio codec(" + std::string(profile_string) + ") is not supported"); | 47 "Audio codec(" + std::string(profile_string) + ") is not supported"); |
| 48 } | 48 } |
| 49 | 49 |
| 50 class AACTest : public testing::Test { | 50 class AACTest : public testing::Test { |
| 51 public: | 51 public: |
| 52 AACTest() : media_log_(new StrictMock<MockMediaLog>()) {} | 52 AACTest() {} |
| 53 | 53 |
| 54 bool Parse(const std::vector<uint8_t>& data) { | 54 bool Parse(const std::vector<uint8_t>& data) { |
| 55 return aac_.Parse(data, media_log_); | 55 return aac_.Parse(data, &media_log_); |
| 56 } | 56 } |
| 57 | 57 |
| 58 scoped_refptr<StrictMock<MockMediaLog>> media_log_; | 58 StrictMock<MockMediaLog> media_log_; |
| 59 AAC aac_; | 59 AAC aac_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 TEST_F(AACTest, BasicProfileTest) { | 62 TEST_F(AACTest, BasicProfileTest) { |
| 63 uint8_t buffer[] = {0x12, 0x10}; | 63 uint8_t buffer[] = {0x12, 0x10}; |
| 64 std::vector<uint8_t> data; | 64 std::vector<uint8_t> data; |
| 65 | 65 |
| 66 data.assign(buffer, buffer + sizeof(buffer)); | 66 data.assign(buffer, buffer + sizeof(buffer)); |
| 67 | 67 |
| 68 EXPECT_TRUE(Parse(data)); | 68 EXPECT_TRUE(Parse(data)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 EXPECT_MEDIA_LOG(UnsupportedExtensionFrequencyIndexLog("e")); | 232 EXPECT_MEDIA_LOG(UnsupportedExtensionFrequencyIndexLog("e")); |
| 233 EXPECT_FALSE(Parse(data)); | 233 EXPECT_FALSE(Parse(data)); |
| 234 | 234 |
| 235 data[1] = 0x11; | 235 data[1] = 0x11; |
| 236 EXPECT_TRUE(Parse(data)); | 236 EXPECT_TRUE(Parse(data)); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace mp4 | 239 } // namespace mp4 |
| 240 | 240 |
| 241 } // namespace media | 241 } // namespace media |
| OLD | NEW |