1 /* 2 * Copyright 2021 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 #pragma once 18 19 #include <aidl/android/hardware/tv/tuner/DemuxCapabilities.h> 20 #include <aidl/android/hardware/tv/tuner/DemuxInfo.h> 21 #include <aidl/android/hardware/tv/tuner/IDemux.h> 22 #include <aidl/android/hardware/tv/tuner/IFilter.h> 23 #include <aidl/android/hardware/tv/tuner/ITuner.h> 24 25 #include <gtest/gtest.h> 26 #include <log/log.h> 27 28 using ::testing::AssertionResult; 29 30 using namespace aidl::android::hardware::tv::tuner; 31 32 class DemuxTests { 33 public: setService(std::shared_ptr<ITuner> tuner)34 void setService(std::shared_ptr<ITuner> tuner) { mService = tuner; } 35 36 AssertionResult getDemuxIds(std::vector<int32_t>& demuxIds); 37 AssertionResult openDemux(std::shared_ptr<IDemux>& demux, int32_t& demuxId); 38 AssertionResult openDemuxById(int32_t demuxId, std::shared_ptr<IDemux>& demux); 39 AssertionResult setDemuxFrontendDataSource(int32_t frontendId); 40 AssertionResult getAvSyncId(std::shared_ptr<IFilter> filter, int32_t& avSyncHwId); 41 AssertionResult getAvSyncTime(int32_t avSyncId); 42 AssertionResult getDemuxCaps(DemuxCapabilities& demuxCaps); 43 AssertionResult getDemuxInfo(int32_t demuxId, DemuxInfo& demuxInfo); 44 AssertionResult closeDemux(); 45 46 protected: failure()47 static AssertionResult failure() { return ::testing::AssertionFailure(); } 48 success()49 static AssertionResult success() { return ::testing::AssertionSuccess(); } 50 51 std::shared_ptr<ITuner> mService; 52 std::shared_ptr<IDemux> mDemux; 53 }; 54