#include "third_party/blink/renderer/modules/media/audio/mojo_audio_output_ipc.h"
#include <algorithm>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/gtest_util.h"
#include "media/audio/audio_device_description.h"
#include "media/base/audio_parameters.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/utility/utility.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
_;
AtLeast;
Invoke;
Mock;
StrictMock;
namespace blink {
namespace {
const size_t kMemoryLength = …;
const char kDeviceId[] = …;
const char kReturnedDeviceId[] = …;
const double kNewVolume = …;
media::AudioParameters Params() { … }
MojoAudioOutputIPC::FactoryAccessorCB NullAccessor() { … }
class TestStreamProvider
: public media::mojom::blink::AudioOutputStreamProvider { … };
class TestRemoteFactory
: public blink::mojom::blink::RendererAudioOutputStreamFactory { … };
class MockStream : public media::mojom::blink::AudioOutputStream { … };
class MockDelegate : public media::AudioOutputIPCDelegate { … };
}
TEST(MojoAudioOutputIPC, AuthorizeWithoutFactory_CallsAuthorizedWithError) { … }
TEST(MojoAudioOutputIPC,
CreateWithoutAuthorizationWithoutFactory_CallsAuthorizedWithError) { … }
TEST(MojoAudioOutputIPC, DeviceAuthorized_Propagates) { … }
TEST(MojoAudioOutputIPC, OnDeviceCreated_Propagates) { … }
TEST(MojoAudioOutputIPC,
CreateWithoutAuthorization_RequestsAuthorizationFirst) { … }
TEST(MojoAudioOutputIPC, IsReusable) { … }
TEST(MojoAudioOutputIPC, IsReusableAfterError) { … }
TEST(MojoAudioOutputIPC, DeviceNotAuthorized_Propagates) { … }
TEST(MojoAudioOutputIPC,
FactoryDisconnectedBeforeAuthorizationReply_CallsAuthorizedAnyways) { … }
TEST(MojoAudioOutputIPC,
FactoryDisconnectedAfterAuthorizationReply_CallsAuthorizedOnlyOnce) { … }
TEST(MojoAudioOutputIPC, AuthorizeNoClose_DCHECKs) { … }
TEST(MojoAudioOutputIPC, CreateNoClose_DCHECKs) { … }
TEST(MojoAudioOutputIPC, Play_Plays) { … }
TEST(MojoAudioOutputIPC, Pause_Pauses) { … }
TEST(MojoAudioOutputIPC, SetVolume_SetsVolume) { … }
}