Index: base/scoped_native_library_unittest.cc |
diff --git a/base/scoped_native_library_unittest.cc b/base/scoped_native_library_unittest.cc |
index c120555ec69a1ae0f216a53dc5f8f53035b61f6e..035faa03f741119029ecafc278a979b30d6e53d3 100644 |
--- a/base/scoped_native_library_unittest.cc |
+++ b/base/scoped_native_library_unittest.cc |
@@ -18,19 +18,25 @@ TEST(ScopedNativeLibrary, Basic) { |
// Get the pointer to DirectDrawCreate() from "ddraw.dll" and verify it |
// is valid only in this scope. |
// FreeLibrary() doesn't actually unload a DLL until its reference count |
- // becomes zero, i.e. this function pointer is still valid if the DLL used |
+ // becomes zero, i.e. function pointer is still valid if the DLL used |
// in this test is also used by another part of this executable. |
// So, this test uses "ddraw.dll", which is not used by Chrome at all but |
// installed on all versions of Windows. |
- FARPROC test_function; |
+ const char kFunctionName[] = "DirectDrawCreate"; |
+ NativeLibrary native_library; |
{ |
cpu_(ooo_6.6-7.5)
2013/10/30 20:08:45
the code here is different, the scope blocks of 26
Tomasz Moniuszko
2013/10/31 09:13:37
Why do you think we are testing different cases? I
|
FilePath path(GetNativeLibraryName(L"ddraw")); |
- ScopedNativeLibrary library(path); |
- test_function = reinterpret_cast<FARPROC>( |
- library.GetFunctionPointer("DirectDrawCreate")); |
+ 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_NE(0, IsBadCodePtr(test_function)); |
+ EXPECT_EQ(NULL, |
+ GetFunctionPointerFromNativeLibrary(native_library, kFunctionName)); |
#endif |
} |