Chromium Code Reviews| Index: components/copresence/mediums/audio/audio_player_unittest.cc |
| diff --git a/components/copresence/mediums/audio/audio_player_unittest.cc b/components/copresence/mediums/audio/audio_player_unittest.cc |
| index 6e5a66e4575dc36d3a5ba0d293e4cd21dc5f28b4..88faf8c50480331fb8113bc02fcc58703c90c57d 100644 |
| --- a/components/copresence/mediums/audio/audio_player_unittest.cc |
| +++ b/components/copresence/mediums/audio/audio_player_unittest.cc |
| @@ -104,8 +104,10 @@ class AudioPlayerTest : public testing::Test, |
| player_->FlushAudioLoopForTesting(); |
| int differences = 0; |
| - for (int i = 0; i < samples->frames(); ++i) |
| - differences += (buffer_->channel(0)[i] != samples->channel(0)[i]); |
| + for (int i = 0; i < kMaxFrameCount; ++i) { |
| + differences += (buffer_->channel(0)[i] != |
| + samples->channel(0)[i % samples->frames()]); |
| + } |
| ASSERT_EQ(0, differences); |
| buffer_.reset(); |
| @@ -125,7 +127,7 @@ class AudioPlayerTest : public testing::Test, |
| } |
| static const int kDefaultFrameCount = 1024; |
| - static const int kMaxFrameCount = 1024 * 10; |
| + static const int kMaxFrameCount = 1024 * 100; |
| scoped_ptr<media::AudioBus> buffer_; |
| int buffer_index_; |
| @@ -180,7 +182,18 @@ TEST_F(AudioPlayerTest, OutOfOrderPlayAndStopMultiple) { |
| } |
| TEST_F(AudioPlayerTest, PlayingEndToEnd) { |
| - const int kNumSamples = kDefaultFrameCount * 10; |
| + // Ensure that kNumsamples is never over kMaxFrameCount. |
|
Charlie
2015/01/29 17:35:03
This and the additional instance below should be D
rkc
2015/01/29 17:42:42
Added the DCHECK to PlayAndVerifySamples instead,
|
| + const int kNumSamples = kDefaultFrameCount * 32; |
| + CreatePlayer(); |
| + |
| + PlayAndVerifySamples(CreateRandomAudioRefCounted(0x1337, 1, kNumSamples)); |
| + |
| + DeletePlayer(); |
| +} |
| + |
| +TEST_F(AudioPlayerTest, PlayingEndToEndOddSizes) { |
| + // Ensure that kNumsamples is never over kMaxFrameCount. |
| + const int kNumSamples = kDefaultFrameCount * 7 + 321; |
| CreatePlayer(); |
| PlayAndVerifySamples(CreateRandomAudioRefCounted(0x1337, 1, kNumSamples)); |