Files
android/proprietary/wvm/test/Testlibwvm.cpp
Edwin Wong 1fee8fd75a Install proprietary userspace modules under /vendor.
BUG: 5284436

Change-Id: I9921b8446626b7041a3fc66bff918d3adac5bbe1
2011-10-14 14:09:12 -07:00

82 lines
2.2 KiB
C++

/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dlfcn.h>
#include <iostream>
#include "include/WVMExtractor.h"
#include <media/stagefright/Utils.h>
#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/FileSource.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaDebug.h>
using namespace android;
using namespace std;
class TestLibWVM
{
public:
TestLibWVM() {}
~TestLibWVM() {}
// Tests
void Load();
};
DrmManagerClient* gDrmManagerClient;
// This test just confirms that there are no unresolved symbols in libwvm and we
// can locate the entry point.
void TestLibWVM::Load()
{
cout << "TestLibWVM::Load" << endl;
const char *path = "/vendor/lib/libwvm.so";
void *handle = dlopen(path, RTLD_NOW);
if (handle == NULL) {
fprintf(stderr, "Can't open plugin: %s: %s\n", path, dlerror());
exit(-1);
}
typedef MediaExtractor *(*GetInstanceFunc)(sp<DataSource>);
GetInstanceFunc getInstanceFunc =
(GetInstanceFunc) dlsym(handle,
"_ZN7android11GetInstanceENS_2spINS_10DataSourceEEE");
// Basic test - just see if we can instantiate the object and call a method
if (getInstanceFunc) {
LOGD("Found GetInstanceFunc");
} else {
LOGE("Failed to locate GetInstance in libwvm.so");
}
dlclose(handle);
printf("Test successful!\n");
exit(0);
}
int main(int argc, char **argv)
{
TestLibWVM test;
test.Load();
}