api/test: Create MockAudioSink

Bug: webrtc:9620
Change-Id: Iae339c07c91a42dcb3bb79f0c8003311810224a7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226324
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34489}
This commit is contained in:
Florent Castelli 2021-07-16 17:13:54 +02:00 committed by WebRTC LUCI CQ
parent 48a8047f83
commit 2b4f5130dd
3 changed files with 57 additions and 0 deletions

View File

@ -834,6 +834,17 @@ if (rtc_include_tests) {
]
}
rtc_source_set("mock_audio_sink") {
testonly = true
sources = [ "test/mock_audio_sink.h" ]
deps = [
"../api:media_stream_interface",
"../test:test_support",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_source_set("mock_data_channel") {
visibility = [ "*" ]
testonly = true
@ -1118,6 +1129,7 @@ if (rtc_include_tests) {
":fake_frame_encryptor",
":mock_async_dns_resolver",
":mock_audio_mixer",
":mock_audio_sink",
":mock_data_channel",
":mock_frame_decryptor",
":mock_frame_encryptor",

View File

@ -32,6 +32,7 @@
#include "api/test/fake_frame_encryptor.h"
#include "api/test/mock_async_dns_resolver.h"
#include "api/test/mock_audio_mixer.h"
#include "api/test/mock_audio_sink.h"
#include "api/test/mock_data_channel.h"
#include "api/test/mock_frame_decryptor.h"
#include "api/test/mock_frame_encryptor.h"

View File

@ -0,0 +1,44 @@
/*
* Copyright 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_TEST_MOCK_AUDIO_SINK_H_
#define API_TEST_MOCK_AUDIO_SINK_H_
#include "absl/types/optional.h"
#include "api/media_stream_interface.h"
#include "test/gmock.h"
namespace webrtc {
class MockAudioSink final : public webrtc::AudioTrackSinkInterface {
public:
MOCK_METHOD(void,
OnData,
(const void* audio_data,
int bits_per_sample,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames),
(override));
MOCK_METHOD(void,
OnData,
(const void* audio_data,
int bits_per_sample,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms),
(override));
};
} // namespace webrtc
#endif // API_TEST_MOCK_AUDIO_SINK_H_