Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2663)

Unified Diff: base/scoped_native_library_unittest.cc

Issue 32303002: ScopedNativeLibrary.Basic test fix (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: const char* kFunctionName changed to const char kFunctionName[] Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698