| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <cstdlib> | 5 #include <cstdlib> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 ASSERT_TRUE(PathService::Get(DIR_EXE, &other_library_path)); | 265 ASSERT_TRUE(PathService::Get(DIR_EXE, &other_library_path)); |
| 266 other_library_path = other_library_path.Append(FilePath::FromUTF16Unsafe( | 266 other_library_path = other_library_path.Append(FilePath::FromUTF16Unsafe( |
| 267 GetNativeLibraryName(ASCIIToUTF16( | 267 GetNativeLibraryName(ASCIIToUTF16( |
| 268 "base_profiler_test_support_library")))); | 268 "base_profiler_test_support_library")))); |
| 269 NativeLibraryLoadError load_error; | 269 NativeLibraryLoadError load_error; |
| 270 *library = LoadNativeLibrary(other_library_path, &load_error); | 270 *library = LoadNativeLibrary(other_library_path, &load_error); |
| 271 ASSERT_TRUE(*library) << "error loading " << other_library_path.value() | 271 ASSERT_TRUE(*library) << "error loading " << other_library_path.value() |
| 272 << ": " << load_error.ToString(); | 272 << ": " << load_error.ToString(); |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 NativeLibrary library; | 275 NativeLibrary library = nullptr; |
| 276 load(&library); | 276 load(&library); |
| 277 return library; | 277 return library; |
| 278 } | 278 } |
| 279 | 279 |
| 280 // Unloads |library| and returns when it has completed unloading. Unloading a | 280 // Unloads |library| and returns when it has completed unloading. Unloading a |
| 281 // library is asynchronous on Windows, so simply calling UnloadNativeLibrary() | 281 // library is asynchronous on Windows, so simply calling UnloadNativeLibrary() |
| 282 // is insufficient to ensure it's been unloaded. | 282 // is insufficient to ensure it's been unloaded. |
| 283 void SynchronousUnloadNativeLibrary(NativeLibrary library) { | 283 void SynchronousUnloadNativeLibrary(NativeLibrary library) { |
| 284 UnloadNativeLibrary(library); | 284 UnloadNativeLibrary(library); |
| 285 #if defined(OS_WIN) | 285 #if defined(OS_WIN) |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) | 954 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |
| 955 #define MAYBE_UnloadedLibrary UnloadedLibrary | 955 #define MAYBE_UnloadedLibrary UnloadedLibrary |
| 956 #else | 956 #else |
| 957 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary | 957 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary |
| 958 #endif | 958 #endif |
| 959 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { | 959 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { |
| 960 TestLibraryUnload(true); | 960 TestLibraryUnload(true); |
| 961 } | 961 } |
| 962 | 962 |
| 963 } // namespace base | 963 } // namespace base |
| OLD | NEW |