This source file includes following definitions.
- TestDlopenMainThread
- CheckSecondaryThreadSuccess
- SecondaryThreadFunc
- TestDlopenSecondaryThread
- SetupTests
- SetupPluginInterfaces
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include "ppapi/c/pp_errors.h"
#include "ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h"
#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
#include "ppapi/native_client/tests/ppapi_test_lib/testable_callback.h"
namespace {
void TestDlopenMainThread() {
void* lib_handle = dlopen("libmemusage.so", RTLD_LAZY);
EXPECT(lib_handle == NULL);
TEST_PASSED;
}
void CheckSecondaryThreadSuccess(void *lib_handle, int32_t unused_result) {
EXPECT(lib_handle != NULL);
PostTestMessage("TestDlopenSecondaryThread", "PASSED");
}
void* SecondaryThreadFunc(void *unused_data) {
void* lib_handle = dlopen("libmemusage.so", RTLD_LAZY);
PP_CompletionCallback callback = PP_MakeCompletionCallback(
CheckSecondaryThreadSuccess,
lib_handle);
PPBCore()->CallOnMainThread(0, callback, PP_OK);
return NULL;
}
void TestDlopenSecondaryThread() {
pthread_t p;
pthread_create(&p, NULL, SecondaryThreadFunc, NULL);
}
}
void SetupTests() {
RegisterTest("TestDlopenMainThread", TestDlopenMainThread);
RegisterTest("TestDlopenSecondaryThread", TestDlopenSecondaryThread);
}
void SetupPluginInterfaces() {
}