Commit 3188eea3 authored by Wez's avatar Wez Committed by Commit Bot

[fuchsia] Use FIDL TestBase for TestAudioCapturer.

Using the AudioCapturer_TestBase allows the TestAudioCapturer to compile
even if new APIs are added to the AudioCapturer API, and reduces the
amount of boilerplate for APIs which are not expected to be called.

This is required in order to unblock the next Fuchsia SDK roll.

TBR: sergeyu
Bug: fuchsia:48420, 1047390
Change-Id: I15ccc2c50bba2ea6bd30d2508b5d7e6e668d73aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106582
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750968}
parent e9388fc6
......@@ -4,6 +4,7 @@
#include "media/fuchsia/audio/fuchsia_audio_capturer_source.h"
#include <fuchsia/media/cpp/fidl_test_base.h>
#include <lib/fidl/cpp/binding.h>
#include "base/fuchsia/fuchsia_logging.h"
......@@ -18,7 +19,8 @@ namespace {
constexpr size_t kFramesPerPacket = 480;
constexpr uint32_t kBufferId = 0;
class TestAudioCapturer : public fuchsia::media::AudioCapturer {
class TestAudioCapturer
: public fuchsia::media::testing::AudioCapturer_TestBase {
public:
TestAudioCapturer(
fidl::InterfaceRequest<fuchsia::media::AudioCapturer> request)
......@@ -109,25 +111,10 @@ class TestAudioCapturer : public fuchsia::media::AudioCapturer {
packets_usage_[buffer_index] = false;
}
// The following AudioCapturer methods are not expected to be called.
void RemovePayloadBuffer(uint32_t id) final { FAIL(); }
void DiscardAllPackets(DiscardAllPacketsCallback callback) final { FAIL(); }
void DiscardAllPacketsNoReply() final { FAIL(); }
void StopAsyncCaptureNoReply() final { FAIL(); }
void CaptureAt(uint32_t payload_buffer_id,
uint32_t payload_offset,
uint32_t frames,
CaptureAtCallback callback) final {
FAIL();
}
void StopAsyncCapture(StopAsyncCaptureCallback callback) final { FAIL(); }
void BindGainControl(
fidl::InterfaceRequest<fuchsia::media::audio::GainControl>
gain_control_request) final {
FAIL();
// No other methods are expected to be called.
void NotImplemented_(const std::string& name) final {
FAIL() << ": " << name;
}
void SetUsage(fuchsia::media::AudioCaptureUsage usage) final { FAIL(); }
void GetStreamType(GetStreamTypeCallback callback) final { FAIL(); }
private:
fidl::Binding<fuchsia::media::AudioCapturer> binding_;
......@@ -341,4 +328,4 @@ TEST_F(FuchsiaAudioCapturerSourceTest, CaptureAfterStop) {
ASSERT_EQ(callback_.packets().size(), 0U);
}
} // namespace media
\ No newline at end of file
} // namespace media
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment