[android/platform-hardware-interfaces.git] / media / omx / 1.0 / vts / functional / audio / VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 38cdcd6508f596aed796810d0efc4544d8c467e1..4543c012523964364e73e684d6a9fbc344b72b8e 100644 (file)
#include <media_hidl_test_common.h>
#include <fstream>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- void setRes(const char* _res) { res = _res; }
-
- const hidl_string getInstance() const { return instance; }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- const hidl_string getRes() const { return res; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'},
- {"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {"res", required_argument, 0, 'P'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:C:R:P:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case 'P':
- setRes(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n"
- "-C, --component: OMX component to test\n"
- "-R, --role: OMX component Role\n"
- "-P, --res: Resource files directory location\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
- hidl_string res;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
// audio decoder test fixture class
this->omxNode = _nl;
})
.isOk());
+ if (status == android::hardware::media::omx::V1_0::Status::NAME_NOT_FOUND) {
+ disableTest = true;
+ std::cout << "[ WARN ] Test Disabled, component not present\n";
+ return;
+ }
ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
ASSERT_NE(omxNode, nullptr);
ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
framesReceived = 0;
timestampUs = 0;
timestampDevTest = false;
+ isSecure = false;
+ size_t suffixLen = strlen(".secure");
+ if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
+ isSecure =
+ !strcmp(gEnv->getComponent().c_str() +
+ strlen(gEnv->getComponent().c_str()) - suffixLen,
+ ".secure");
+ }
+ if (isSecure) disableTest = true;
if (disableTest) std::cout << "[ WARN ] Test Disabled \n";
}
OMX_AUDIO_CODINGTYPE eEncoding;
bool disableTest;
bool eosFlag;
+ bool isSecure;
uint32_t framesReceived;
uint64_t timestampUs;
::android::List<uint64_t> timestampUslist;
setupAACPort(omxNode, portIndex, OMX_AUDIO_AACObjectNull,
OMX_AUDIO_AACStreamFormatMP4FF, nChannels, 0,
nSampleRate);
+ break;
default:
break;
}
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();