| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 EXPECT_CALL(*mock_encoder_, SampleRateHz()) | 46 EXPECT_CALL(*mock_encoder_, SampleRateHz()) |
| 47 .WillRepeatedly(Return(sample_rate_hz_)); | 47 .WillRepeatedly(Return(sample_rate_hz_)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void TearDown() override { | 50 void TearDown() override { |
| 51 EXPECT_CALL(*mock_encoder_, Die()).Times(1); | 51 EXPECT_CALL(*mock_encoder_, Die()).Times(1); |
| 52 red_.reset(); | 52 red_.reset(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void Encode() { | 55 void Encode() { |
| 56 ASSERT_TRUE(red_.get() != NULL); | 56 ASSERT_TRUE(red_.get() != nullptr); |
| 57 encoded_.Clear(); | 57 encoded_.Clear(); |
| 58 encoded_info_ = red_->Encode( | 58 encoded_info_ = red_->Encode( |
| 59 timestamp_, | 59 timestamp_, |
| 60 rtc::ArrayView<const int16_t>(audio_, num_audio_samples_10ms), | 60 rtc::ArrayView<const int16_t>(audio_, num_audio_samples_10ms), |
| 61 &encoded_); | 61 &encoded_); |
| 62 timestamp_ += num_audio_samples_10ms; | 62 timestamp_ += num_audio_samples_10ms; |
| 63 } | 63 } |
| 64 | 64 |
| 65 MockAudioEncoder* mock_encoder_; | 65 MockAudioEncoder* mock_encoder_; |
| 66 std::unique_ptr<AudioEncoderCopyRed> red_; | 66 std::unique_ptr<AudioEncoderCopyRed> red_; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 TEST_F(AudioEncoderCopyRedDeathTest, WrongFrameSize) { | 288 TEST_F(AudioEncoderCopyRedDeathTest, WrongFrameSize) { |
| 289 num_audio_samples_10ms *= 2; // 20 ms frame. | 289 num_audio_samples_10ms *= 2; // 20 ms frame. |
| 290 EXPECT_DEATH(Encode(), ""); | 290 EXPECT_DEATH(Encode(), ""); |
| 291 num_audio_samples_10ms = 0; // Zero samples. | 291 num_audio_samples_10ms = 0; // Zero samples. |
| 292 EXPECT_DEATH(Encode(), ""); | 292 EXPECT_DEATH(Encode(), ""); |
| 293 } | 293 } |
| 294 | 294 |
| 295 TEST_F(AudioEncoderCopyRedDeathTest, NullSpeechEncoder) { | 295 TEST_F(AudioEncoderCopyRedDeathTest, NullSpeechEncoder) { |
| 296 AudioEncoderCopyRed* red = NULL; | 296 AudioEncoderCopyRed* red = nullptr; |
| 297 AudioEncoderCopyRed::Config config; | 297 AudioEncoderCopyRed::Config config; |
| 298 config.speech_encoder = NULL; | 298 config.speech_encoder = nullptr; |
| 299 EXPECT_DEATH(red = new AudioEncoderCopyRed(std::move(config)), | 299 EXPECT_DEATH(red = new AudioEncoderCopyRed(std::move(config)), |
| 300 "Speech encoder not provided."); | 300 "Speech encoder not provided."); |
| 301 // The delete operation is needed to avoid leak reports from memcheck. | 301 // The delete operation is needed to avoid leak reports from memcheck. |
| 302 delete red; | 302 delete red; |
| 303 } | 303 } |
| 304 | 304 |
| 305 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 305 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 306 | 306 |
| 307 } // namespace webrtc | 307 } // namespace webrtc |
| OLD | NEW |