| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 TEST(DecoderDatabase, ExternalDecoder) { | 136 TEST(DecoderDatabase, ExternalDecoder) { |
| 137 DecoderDatabase db(new rtc::RefCountedObject<MockAudioDecoderFactory>); | 137 DecoderDatabase db(new rtc::RefCountedObject<MockAudioDecoderFactory>); |
| 138 const uint8_t kPayloadType = 0; | 138 const uint8_t kPayloadType = 0; |
| 139 const std::string kCodecName = "Robert\'); DROP TABLE Students;"; | 139 const std::string kCodecName = "Robert\'); DROP TABLE Students;"; |
| 140 MockAudioDecoder decoder; | 140 MockAudioDecoder decoder; |
| 141 // Load into database. | 141 // Load into database. |
| 142 EXPECT_EQ(DecoderDatabase::kOK, | 142 EXPECT_EQ(DecoderDatabase::kOK, |
| 143 db.InsertExternal(kPayloadType, NetEqDecoder::kDecoderPCMu, | 143 db.InsertExternal(kPayloadType, NetEqDecoder::kDecoderPCMu, |
| 144 kCodecName, 8000, &decoder)); | 144 kCodecName, &decoder)); |
| 145 EXPECT_EQ(1, db.Size()); | 145 EXPECT_EQ(1, db.Size()); |
| 146 // Get decoder and make sure we get the external one. | 146 // Get decoder and make sure we get the external one. |
| 147 EXPECT_EQ(&decoder, db.GetDecoder(kPayloadType)); | 147 EXPECT_EQ(&decoder, db.GetDecoder(kPayloadType)); |
| 148 // Get the decoder info struct and check it too. | 148 // Get the decoder info struct and check it too. |
| 149 const DecoderDatabase::DecoderInfo* info; | 149 const DecoderDatabase::DecoderInfo* info; |
| 150 info = db.GetDecoderInfo(kPayloadType); | 150 info = db.GetDecoderInfo(kPayloadType); |
| 151 ASSERT_TRUE(info != NULL); | 151 ASSERT_TRUE(info != NULL); |
| 152 EXPECT_EQ(NetEqDecoder::kDecoderPCMu, info->codec_type); | 152 EXPECT_EQ(NetEqDecoder::kDecoderPCMu, info->codec_type); |
| 153 EXPECT_EQ(kCodecName, info->name); | 153 EXPECT_EQ(kCodecName, info->name); |
| 154 // Expect not to delete the decoder when removing it from the database, since | 154 // Expect not to delete the decoder when removing it from the database, since |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 EXPECT_EQ(DecoderDatabase::kOK, db.Remove(13)); | 249 EXPECT_EQ(DecoderDatabase::kOK, db.Remove(13)); |
| 250 EXPECT_EQ(NULL, db.GetActiveCngDecoder()); | 250 EXPECT_EQ(NULL, db.GetActiveCngDecoder()); |
| 251 | 251 |
| 252 // Try to set non-existing codecs as active. | 252 // Try to set non-existing codecs as active. |
| 253 EXPECT_EQ(DecoderDatabase::kDecoderNotFound, | 253 EXPECT_EQ(DecoderDatabase::kDecoderNotFound, |
| 254 db.SetActiveDecoder(17, &changed)); | 254 db.SetActiveDecoder(17, &changed)); |
| 255 EXPECT_EQ(DecoderDatabase::kDecoderNotFound, | 255 EXPECT_EQ(DecoderDatabase::kDecoderNotFound, |
| 256 db.SetActiveCngDecoder(17)); | 256 db.SetActiveCngDecoder(17)); |
| 257 } | 257 } |
| 258 } // namespace webrtc | 258 } // namespace webrtc |
| OLD | NEW |