1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
media / mojo / services / mediadrm_support_service_unittest.cc [blame]
// Copyright 2024 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/mediadrm_support_service.h"
#include <memory>
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "media/mojo/mojom/mediadrm_support.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
namespace media {
namespace {
class MediaDrmSupportServiceTest : public testing::Test {
public:
void Initialize() {
service_ = std::make_unique<MediaDrmSupportService>(
remote_.BindNewPipeAndPassReceiver());
}
protected:
base::test::TaskEnvironment task_environment_;
std::unique_ptr<MediaDrmSupportService> service_;
mojo::Remote<mojom::MediaDrmSupport> remote_;
};
} // namespace
TEST_F(MediaDrmSupportServiceTest, WidevineKeySystem) {
Initialize();
base::test::TestFuture<mojom::MediaDrmSupportResultPtr> support;
service_->IsKeySystemSupported(kWidevineKeySystem, support.GetCallback());
// All Android devices should support some form of Widevine support.
// However, support for WebM and MP4 formats may vary between devices,
// so we cannot check the other parameters.
ASSERT_TRUE(support.Get());
}
TEST_F(MediaDrmSupportServiceTest, UnknownKeySystem) {
const char kUnsupportedKeySystem[] = "keysystem.test.unsupported";
Initialize();
base::test::TestFuture<mojom::MediaDrmSupportResultPtr> support;
service_->IsKeySystemSupported(kUnsupportedKeySystem, support.GetCallback());
// Unknown key system should not be supported.
ASSERT_FALSE(support.Get());
}
} // namespace media