Chromium Code Reviews| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "media/base/mock_media_log.h" | 7 #include "media/base/mock_media_log.h" |
| 8 #include "media/formats/mp4/aac.h" | 8 #include "media/formats/mp4/aac.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 data.push_back(0x12); | 123 data.push_back(0x12); |
| 124 EXPECT_FALSE(Parse(data)); | 124 EXPECT_FALSE(Parse(data)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 TEST_F(AACTest, IncorrectProfileTest) { | 127 TEST_F(AACTest, IncorrectProfileTest) { |
| 128 InSequence s; | 128 InSequence s; |
| 129 uint8 buffer[] = {0x0, 0x08}; | 129 uint8 buffer[] = {0x0, 0x08}; |
| 130 std::vector<uint8> data; | 130 std::vector<uint8> data; |
| 131 | 131 |
| 132 data.assign(buffer, buffer + sizeof(buffer)); | 132 data.assign(buffer, buffer + sizeof(buffer)); |
| 133 | |
| 134 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.0")); | |
| 135 EXPECT_FALSE(Parse(data)); | 133 EXPECT_FALSE(Parse(data)); |
| 136 | 134 |
| 137 data[0] = 0x08; | 135 data[0] = 0x08; |
| 138 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.1")); | 136 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.1")); |
| 139 EXPECT_TRUE(Parse(data)); | 137 EXPECT_TRUE(Parse(data)); |
| 140 | 138 |
| 141 data[0] = 0x28; | 139 data[0] = 0x28; |
| 142 // No media log for this profile 5, since not enough bits are in |data| to | 140 // No media log for this profile 5, since not enough bits are in |data| to |
| 143 // first parse profile 5's extension frequency index. | 141 // first parse profile 5's extension frequency index. |
| 144 EXPECT_FALSE(Parse(data)); | 142 EXPECT_FALSE(Parse(data)); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 157 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.1")); | 155 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.1")); |
| 158 EXPECT_TRUE(Parse(data)); | 156 EXPECT_TRUE(Parse(data)); |
| 159 } | 157 } |
| 160 | 158 |
| 161 TEST_F(AACTest, IncorrectChannelTest) { | 159 TEST_F(AACTest, IncorrectChannelTest) { |
| 162 uint8 buffer[] = {0x0e, 0x00}; | 160 uint8 buffer[] = {0x0e, 0x00}; |
| 163 std::vector<uint8> data; | 161 std::vector<uint8> data; |
| 164 | 162 |
| 165 data.assign(buffer, buffer + sizeof(buffer)); | 163 data.assign(buffer, buffer + sizeof(buffer)); |
| 166 | 164 |
| 167 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.1")).Times(2); | 165 EXPECT_MEDIA_LOG(AudioCodecLog("mp4a.40.1")).Times(1); |
|
wolenetz
2015/08/28 23:29:35
nit: .Times(1) is redundant. Drop this part of thi
msu.koo
2015/08/29 09:36:52
Done.
| |
| 168 | 166 |
| 169 EXPECT_FALSE(Parse(data)); | 167 EXPECT_FALSE(Parse(data)); |
| 170 | 168 |
| 171 data[1] = 0x08; | 169 data[1] = 0x08; |
| 172 EXPECT_TRUE(Parse(data)); | 170 EXPECT_TRUE(Parse(data)); |
| 173 } | 171 } |
| 174 | 172 |
| 175 } // namespace mp4 | 173 } // namespace mp4 |
| 176 | 174 |
| 177 } // namespace media | 175 } // namespace media |
| OLD | NEW |