Skip to content

Commit

Permalink
Zero out AudioBus in CAM test
Browse files Browse the repository at this point in the history
Memory sanitizer is failing for CastAudioManagerTest because the
audio bus data is not initialized.

Bug: b/111993375
Test: cast_media_unittests+msan
Change-Id: I5ef5c7e0dbc5247fbdeccef1f04c3e295a62a93c
Reviewed-on: https://chromium-review.googlesource.com/1191522
Reviewed-by: Kenneth MacKay <kmackay@chromium.org>
Commit-Queue: Aidan Wolter <awolter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586410}
  • Loading branch information
Aidan Wolter authored and Commit Bot committed Aug 27, 2018
1 parent 6ae843f commit 6bef004
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions chromecast/media/audio/cast_audio_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ std::unique_ptr<service_manager::Connector> CreateConnector() {
service_manager::mojom::ConnectorRequest request;
return service_manager::Connector::Create(&request);
}

int OnMoreData(base::TimeDelta delay,
base::TimeTicks delay_timestamp,
int prior_frames_skipped,
::media::AudioBus* dest) {
dest->Zero();
return kDefaultAudioParams.frames_per_buffer();
}

} // namespace

namespace chromecast {
Expand Down Expand Up @@ -169,7 +178,7 @@ TEST_F(CastAudioManagerTest, CanMakeStream) {
EXPECT_TRUE(stream->Open());

EXPECT_CALL(mock_source_callback_, OnMoreData(_, _, _, _))
.WillRepeatedly(Return(kDefaultAudioParams.frames_per_buffer()));
.WillRepeatedly(Invoke(OnMoreData));
EXPECT_CALL(mock_source_callback_, OnError()).Times(0);
stream->Start(&mock_source_callback_);
scoped_task_environment_.RunUntilIdle();
Expand All @@ -187,7 +196,7 @@ TEST_F(CastAudioManagerTest, CanMakeStreamProxy) {
EXPECT_TRUE(stream->Open());

EXPECT_CALL(mock_source_callback_, OnMoreData(_, _, _, _))
.WillRepeatedly(Return(kDefaultAudioParams.frames_per_buffer()));
.WillRepeatedly(Invoke(OnMoreData));
EXPECT_CALL(mock_source_callback_, OnError()).Times(0);
stream->Start(&mock_source_callback_);
scoped_task_environment_.RunUntilIdle();
Expand All @@ -206,7 +215,7 @@ TEST_F(CastAudioManagerTest, CanMakeMixerStream) {
EXPECT_TRUE(stream->Open());

EXPECT_CALL(mock_source_callback_, OnMoreData(_, _, _, _))
.WillRepeatedly(Return(kDefaultAudioParams.frames_per_buffer()));
.WillRepeatedly(Invoke(OnMoreData));
EXPECT_CALL(mock_source_callback_, OnError()).Times(0);
stream->Start(&mock_source_callback_);
scoped_task_environment_.RunUntilIdle();
Expand Down

0 comments on commit 6bef004

Please sign in to comment.