#include <stdint.h>
#include <memory>
#include <tuple>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "media/base/cdm_config.h"
#include "media/base/mock_filters.h"
#include "media/base/test_helpers.h"
#include "media/cdm/clear_key_cdm_common.h"
#include "media/media_buildflags.h"
#include "media/mojo/buildflags.h"
#include "media/mojo/clients/mojo_decryptor.h"
#include "media/mojo/clients/mojo_demuxer_stream_impl.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/mojom/content_decryption_module.mojom.h"
#include "media/mojo/mojom/decryptor.mojom.h"
#include "media/mojo/mojom/interface_factory.mojom.h"
#include "media/mojo/mojom/media_service.mojom.h"
#include "media/mojo/mojom/renderer.mojom.h"
#include "media/mojo/services/media_service_factory.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace media {
namespace {
_;
DoAll;
Invoke;
InvokeWithoutArgs;
NiceMock;
SaveArg;
StrictMock;
WithArg;
MATCHER_P(MatchesResult, success, "") { … }
#if BUILDFLAG(ENABLE_MOJO_CDM) && !BUILDFLAG(IS_ANDROID)
const char kInvalidKeySystem[] = …;
#endif
class MockRendererClient : public mojom::RendererClient { … };
ACTION_P(QuitLoop, run_loop) { … }
class MediaServiceTest : public testing::Test { … };
}
#if BUILDFLAG(ENABLE_MOJO_CDM) && !BUILDFLAG(IS_ANDROID)
TEST_F(MediaServiceTest, InitializeCdm_Success) { … }
TEST_F(MediaServiceTest, InitializeCdm_InvalidKeySystem) { … }
#endif
#if BUILDFLAG(ENABLE_MOJO_RENDERER)
TEST_F(MediaServiceTest, InitializeRenderer) {
InitializeRenderer(TestVideoConfig::Normal(), true);
}
#endif
TEST_F(MediaServiceTest, InterfaceFactoryPreventsIdling) { … }
#if (BUILDFLAG(ENABLE_MOJO_CDM) && !BUILDFLAG(IS_ANDROID)) || \
BUILDFLAG(ENABLE_MOJO_RENDERER)
TEST_F(MediaServiceTest, Idling) { … }
TEST_F(MediaServiceTest, MoreIdling) { … }
#endif
}