chromium/media/mojo/services/cdm_service_unittest.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/mojo/services/cdm_service.h"

#include <memory>
#include <tuple>

#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "media/base/mock_filters.h"
#include "media/cdm/clear_key_cdm_common.h"
#include "media/cdm/default_cdm_factory.h"
#include "media/media_buildflags.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 {

_;
Invoke;
InvokeWithoutArgs;
NiceMock;
Return;

MATCHER_P(MatchesResult, success, "") {}

// MockCdmFactory treats any non-empty key system as valid and the empty key
// system as invalid.
const char kInvalidKeySystem[] =;

// Needed since MockCdmServiceClient needs to return unique_ptr of CdmFactory.
class CdmFactoryWrapper : public CdmFactory {};

class MockCdmServiceClient : public CdmService::Client {};

class CdmServiceTest : public testing::Test {};

}  // namespace

TEST_F(CdmServiceTest, InitializeCdm_Success) {}

TEST_F(CdmServiceTest, InitializeCdm_InvalidKeySystem) {}

TEST_F(CdmServiceTest, DestroyAndRecreateCdm) {}

// CdmFactory disconnection will cause the service to idle.
TEST_F(CdmServiceTest, DestroyCdmFactory) {}

// Destroy service will destroy the CdmFactory and all CDMs.
TEST_F(CdmServiceTest, DestroyCdmService_AfterCdmCreation) {}

// Before the CDM is fully created, CdmService has been destroyed. We should
// fail gracefully instead of a crash. See crbug.com/1190319.
TEST_F(CdmServiceTest, DestroyCdmService_DuringCdmCreation) {}

}  // namespace media