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

Side by Side Diff: base/memory/scoped_native_library_unittest.cc

Issue 6714032: Move some files in base to base/memory. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: only base Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/scoped_native_library.h" 5 #include "base/memory/scoped_native_library.h"
6 #if defined(OS_WIN) 6 #if defined(OS_WIN)
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #endif 8 #endif
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 // Tests whether or not a function pointer retrieved via ScopedNativeLibrary 12 // Tests whether or not a function pointer retrieved via ScopedNativeLibrary
13 // is available only in a scope. 13 // is available only in a scope.
14 TEST(ScopedNativeLibrary, Basic) { 14 TEST(ScopedNativeLibrary, Basic) {
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 // Get the pointer to DirectDrawCreate() from "ddraw.dll" and verify it 16 // Get the pointer to DirectDrawCreate() from "ddraw.dll" and verify it
17 // is valid only in this scope. 17 // is valid only in this scope.
18 // FreeLibrary() doesn't actually unload a DLL until its reference count 18 // FreeLibrary() doesn't actually unload a DLL until its reference count
19 // becomes zero, i.e. this function pointer is still valid if the DLL used 19 // becomes zero, i.e. this function pointer is still valid if the DLL used
20 // in this test is also used by another part of this executable. 20 // in this test is also used by another part of this executable.
21 // So, this test uses "ddraw.dll", which is not used by Chrome at all but 21 // So, this test uses "ddraw.dll", which is not used by Chrome at all but
22 // installed on all versions of Windows. 22 // installed on all versions of Windows.
23 FARPROC test_function; 23 FARPROC test_function;
24 { 24 {
25 FilePath path(base::GetNativeLibraryName(L"ddraw")); 25 FilePath path(base::::GetNativeLibraryName(L"ddraw"));
brettw 2011/03/24 20:37:30 Delete ::
26 base::ScopedNativeLibrary library(path); 26 base::ScopedNativeLibrary library(path);
27 test_function = reinterpret_cast<FARPROC>( 27 test_function = reinterpret_cast<FARPROC>(
28 library.GetFunctionPointer("DirectDrawCreate")); 28 library.GetFunctionPointer("DirectDrawCreate"));
29 EXPECT_EQ(0, IsBadCodePtr(test_function)); 29 EXPECT_EQ(0, IsBadCodePtr(test_function));
30 } 30 }
31 EXPECT_NE(0, IsBadCodePtr(test_function)); 31 EXPECT_NE(0, IsBadCodePtr(test_function));
32 #endif 32 #endif
33 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698