1 /*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #define LOG_TAG "drm_hal_vendor_test@1.0"
18
19 #include "vendor_modules.h"
20 #include "android/hardware/drm/1.0/vts/drm_hal_vendor_test.h"
21 #include "android/hardware/drm/1.0/vts/drm_hal_clearkey_test.h"
22
23 using ::android::hardware::drm::V1_0::ICryptoFactory;
24 using ::android::hardware::drm::V1_0::IDrmFactory;
25
26 using ::android::hardware::drm::V1_0::vts::DrmHalClearkeyFactoryTest;
27 using ::android::hardware::drm::V1_0::vts::DrmHalClearkeyPluginTest;
28 using ::android::hardware::drm::V1_0::vts::DrmHalClearkeyDecryptTest;
29
30 using ::android::hardware::drm::V1_0::vts::DrmHalVendorFactoryTest;
31 using ::android::hardware::drm::V1_0::vts::DrmHalVendorPluginTest;
32 using ::android::hardware::drm::V1_0::vts::DrmHalVendorDecryptTest;
33
34 /**
35 * Instantiate the set of test cases for each vendor module
36 */
37
__anon27093c640102null38 static const std::vector<DrmHalTestParam> kAllInstances = [] {
39 std::vector<std::string> drmInstances =
40 android::hardware::getAllHalInstanceNames(IDrmFactory::descriptor);
41 std::vector<std::string> cryptoInstances =
42 android::hardware::getAllHalInstanceNames(ICryptoFactory::descriptor);
43 std::set<std::string> allInstances;
44 allInstances.insert(drmInstances.begin(), drmInstances.end());
45 allInstances.insert(cryptoInstances.begin(), cryptoInstances.end());
46
47 std::vector<DrmHalTestParam> allInstanceUuidCombos;
48 auto noUUID = [](std::string s) { return DrmHalTestParam(s); };
49 std::transform(allInstances.begin(), allInstances.end(),
50 std::back_inserter(allInstanceUuidCombos), noUUID);
51 return allInstanceUuidCombos;
52 }();
53
54 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalVendorFactoryTest);
55 INSTANTIATE_TEST_CASE_P(DrmHalVendorFactoryTestCases, DrmHalVendorFactoryTest,
56 testing::ValuesIn(kAllInstances),
57 drm_vts::PrintParamInstanceToString);
58
59 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalVendorPluginTest);
60 INSTANTIATE_TEST_CASE_P(DrmHalVendorPluginTestCases, DrmHalVendorPluginTest,
61 testing::ValuesIn(kAllInstances),
62 drm_vts::PrintParamInstanceToString);
63
64 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalVendorDecryptTest);
65 INSTANTIATE_TEST_CASE_P(DrmHalVendorDecryptTestCases, DrmHalVendorDecryptTest,
66 testing::ValuesIn(kAllInstances),
67 drm_vts::PrintParamInstanceToString);
68
69 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalClearkeyFactoryTest);
70 INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyFactoryTest, testing::ValuesIn(kAllInstances),
71 drm_vts::PrintParamInstanceToString);
72 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalClearkeyPluginTest);
73 INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyPluginTest, testing::ValuesIn(kAllInstances),
74 drm_vts::PrintParamInstanceToString);
75 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalClearkeyDecryptTest);
76 INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyDecryptTest, testing::ValuesIn(kAllInstances),
77 drm_vts::PrintParamInstanceToString);
78