5 #include "CppUTest/TestHarness.h"
7 TEST_GROUP(AampDrmUtilsTests)
11 TEST(AampDrmUtilsTests, TestGetAbsoluteKeyUri)
13 struct GetAbsoluteKeyUriTestData
15 std::string manifestUrl;
17 std::string expectedUri;
20 const std::vector<GetAbsoluteKeyUriTestData> testData = {
22 {
"http://stream.example/manifest.m3u8",
"basic1.key",
"http://stream.example/basic1.key"},
23 {
"http://stream.example/manifest.m3u8",
"basic2",
"http://stream.example/basic2"},
24 {
"http://stream.example/manifest",
"basic3",
"http://stream.example/basic3"},
25 {
"http://stream.example/assets/hls/manifest.m3u8",
"basic4.key",
"http://stream.example/assets/hls/basic4.key"},
28 {
"http://stream.example/asset/1080p/manifest.m3u8",
"../relkey1.key",
"http://stream.example/asset/1080p/../relkey1.key"},
29 {
"http://stream.example/asset/1080p/../manifest.m3u8",
"../relkey2.key",
"http://stream.example/asset/1080p/../../relkey2.key"},
32 {
"http://stream.example:1234/manifest.m3u8",
"port1.key",
"http://stream.example:1234/port1.key"},
35 {
"https://stream.example/manifest.m3u8",
"secure1.key",
"https://stream.example/secure1.key"},
38 {
"http://stream.example/manifest.m3u8",
"/absref1.key",
"http://stream.example/absref1.key"},
39 {
"http://stream.example/assets/hls/manifest.m3u8",
"/absref2.key",
"http://stream.example/absref2.key"},
42 {
"http://stream.example/manifest.m3u8",
"http://key.example/abs1.key",
"http://key.example/abs1.key"},
43 {
"",
"http://key.example/abs2.key",
"http://key.example/abs2.key"},
46 {
"http://stream.example/manifest.m3u8",
"arg1.key?a=test",
"http://stream.example/arg1.key?a=test"},
47 {
"http://stream.example/manifest.m3u8",
"arg2.key?a=http://",
"http://stream.example/arg2.key?a=http://"},
50 {
"http://stream.example",
"domonly1.key",
"http://stream.example/domonly1.key"},
51 {
"http://stream.example/",
"domonly2.key",
"http://stream.example/domonly2.key"},
52 {
"http://stream.example",
"/domonly3.key",
"http://stream.example/domonly3.key"},
55 {
"http://example/manifest.m3u8",
"file://prot1.key",
"file://prot1.key"},
57 {
"http://example/manifest.m3u8",
"a-b.c+d://prot2.key",
"a-b.c+d://prot2.key"},
59 {
"http://example/manifest.m3u8",
"#abc!://prot3.key",
"http://example/#abc!://prot3.key"},
61 {
"http://example/manifest.m3u8",
"HTTP://key.example/prot4.key",
"HTTP://key.example/prot4.key"},
64 for (
auto test : testData)
68 CHECK_EQUAL(test.expectedUri, keyURI.c_str());