fake_audio_device_enumerator_local_component.cc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include "media/fuchsia/audio/fake_audio_device_enumerator_local_component.h"
  5. #include <vector>
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. namespace media {
  8. FakeAudioDeviceEnumeratorLocalComponent::
  9. FakeAudioDeviceEnumeratorLocalComponent() = default;
  10. FakeAudioDeviceEnumeratorLocalComponent::
  11. ~FakeAudioDeviceEnumeratorLocalComponent() = default;
  12. void FakeAudioDeviceEnumeratorLocalComponent::GetDevices(
  13. GetDevicesCallback callback) {
  14. callback(std::vector<fuchsia::media::AudioDeviceInfo>{
  15. {
  16. .name = "input",
  17. .unique_id = "input",
  18. .token_id = 1,
  19. .is_input = true,
  20. .is_default = true,
  21. },
  22. {
  23. .name = "output",
  24. .unique_id = "output",
  25. .token_id = 2,
  26. .is_input = false,
  27. .is_default = true,
  28. },
  29. });
  30. }
  31. void FakeAudioDeviceEnumeratorLocalComponent::NotImplemented_(
  32. const std::string& name) {
  33. FAIL() << "Unexpected call to unimplemented method \"" << name << "\"";
  34. }
  35. void FakeAudioDeviceEnumeratorLocalComponent::Start(
  36. std::unique_ptr<::component_testing::LocalComponentHandles> mock_handles) {
  37. handles_ = std::move(mock_handles);
  38. ASSERT_EQ(handles_->outgoing()->AddPublicService(bindings_.GetHandler(this)),
  39. ZX_OK);
  40. }
  41. } // namespace media