This source file includes following definitions.
- TEST
#include "base/scoped_native_library.h"
#if defined(OS_WIN)
#include "base/files/file_path.h"
#endif
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
TEST(ScopedNativeLibrary, Basic) {
#if defined(OS_WIN)
const char kFunctionName[] = "DirectDrawCreate";
NativeLibrary native_library;
{
FilePath path(GetNativeLibraryName(L"ddraw"));
native_library = LoadNativeLibrary(path, NULL);
ScopedNativeLibrary library(native_library);
FARPROC test_function =
reinterpret_cast<FARPROC>(library.GetFunctionPointer(kFunctionName));
EXPECT_EQ(0, IsBadCodePtr(test_function));
EXPECT_EQ(
GetFunctionPointerFromNativeLibrary(native_library, kFunctionName),
test_function);
}
EXPECT_EQ(NULL,
GetFunctionPointerFromNativeLibrary(native_library, kFunctionName));
#endif
}
}