fake_audio_device_enumerator_local_component.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_FUCHSIA_AUDIO_FAKE_AUDIO_DEVICE_ENUMERATOR_LOCAL_COMPONENT_H_
  5. #define MEDIA_FUCHSIA_AUDIO_FAKE_AUDIO_DEVICE_ENUMERATOR_LOCAL_COMPONENT_H_
  6. #include <fuchsia/media/cpp/fidl_test_base.h>
  7. #include <lib/fidl/cpp/binding_set.h>
  8. #include <lib/sys/component/cpp/testing/realm_builder.h>
  9. #include <memory>
  10. #include <string>
  11. namespace media {
  12. // A fake AudioDeviceEnumerator for use in tests that use RealmBuilder.
  13. class FakeAudioDeviceEnumeratorLocalComponent final
  14. : public ::fuchsia::media::testing::AudioDeviceEnumerator_TestBase,
  15. public ::component_testing::LocalComponent {
  16. public:
  17. FakeAudioDeviceEnumeratorLocalComponent();
  18. FakeAudioDeviceEnumeratorLocalComponent(
  19. const FakeAudioDeviceEnumeratorLocalComponent&) = delete;
  20. FakeAudioDeviceEnumeratorLocalComponent& operator=(
  21. const FakeAudioDeviceEnumeratorLocalComponent&) = delete;
  22. ~FakeAudioDeviceEnumeratorLocalComponent() override;
  23. // ::fuchsia::media::AudioDeviceEnumerator_TestBase:
  24. void GetDevices(GetDevicesCallback callback) override;
  25. void NotImplemented_(const std::string& name) override;
  26. // ::component_testing::LocalComponent:
  27. void Start(std::unique_ptr<::component_testing::LocalComponentHandles>
  28. mock_handles) override;
  29. private:
  30. fidl::BindingSet<::fuchsia::media::AudioDeviceEnumerator> bindings_;
  31. std::unique_ptr<::component_testing::LocalComponentHandles> handles_;
  32. };
  33. } // namespace media
  34. #endif // MEDIA_FUCHSIA_AUDIO_FAKE_AUDIO_DEVICE_ENUMERATOR_LOCAL_COMPONENT_H_