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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/native_library.h" | 7 #include "base/native_library.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/test/native_library_test_utils.h" | 9 #include "base/test/native_library_test_utils.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return reinterpret_cast<ReturnType(*)(Args...)>( | 79 return reinterpret_cast<ReturnType(*)(Args...)>( |
80 GetFunctionPointerFromNativeLibrary(library_, function_name))(args...); | 80 GetFunctionPointerFromNativeLibrary(library_, function_name))(args...); |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 NativeLibrary library_; | 84 NativeLibrary library_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(TestLibrary); | 86 DISALLOW_COPY_AND_ASSIGN(TestLibrary); |
87 }; | 87 }; |
88 | 88 |
| 89 // NativeLibraaryTest.LoadLibrary is failing on M tablets only. |
| 90 // crbug/641309 |
| 91 #if !defined(OS_ANDROID) |
| 92 |
89 // Verifies that we can load a native library and resolve its exported symbols. | 93 // Verifies that we can load a native library and resolve its exported symbols. |
90 TEST(NativeLibraryTest, LoadLibrary) { | 94 TEST(NativeLibraryTest, LoadLibrary) { |
91 TestLibrary library; | 95 TestLibrary library; |
92 EXPECT_EQ(5, library.Call<int>("GetSimpleTestValue")); | 96 EXPECT_EQ(5, library.Call<int>("GetSimpleTestValue")); |
93 } | 97 } |
94 | 98 |
| 99 #endif // !defined(OS_ANDROID) |
| 100 |
95 // Android dlopen() requires further investigation, as it might vary across | 101 // Android dlopen() requires further investigation, as it might vary across |
96 // versions with respect to symbol resolution scope. | 102 // versions with respect to symbol resolution scope. |
97 #if !defined(OS_ANDROID) | 103 #if !defined(OS_ANDROID) |
98 | 104 |
99 // Verifies that the |prefer_own_symbols| option satisfies its guarantee that | 105 // Verifies that the |prefer_own_symbols| option satisfies its guarantee that |
100 // a loaded library will always prefer local symbol resolution before | 106 // a loaded library will always prefer local symbol resolution before |
101 // considering global symbols. | 107 // considering global symbols. |
102 TEST(NativeLibraryTest, LoadLibraryPreferOwnSymbols) { | 108 TEST(NativeLibraryTest, LoadLibraryPreferOwnSymbols) { |
103 NativeLibraryOptions options; | 109 NativeLibraryOptions options; |
104 options.prefer_own_symbols = true; | 110 options.prefer_own_symbols = true; |
(...skipping 25 matching lines...) Expand all Loading... |
130 EXPECT_EQ(4, library.Call<int>("NativeLibraryTestIncrement")); | 136 EXPECT_EQ(4, library.Call<int>("NativeLibraryTestIncrement")); |
131 EXPECT_EQ(2, NativeLibraryTestIncrement()); | 137 EXPECT_EQ(2, NativeLibraryTestIncrement()); |
132 EXPECT_EQ(3, NativeLibraryTestIncrement()); | 138 EXPECT_EQ(3, NativeLibraryTestIncrement()); |
133 } | 139 } |
134 | 140 |
135 #endif // !defined(OS_ANDROID) | 141 #endif // !defined(OS_ANDROID) |
136 | 142 |
137 #endif // !defined(OS_IOS) && !defined(ADDRESS_SANITIZER) | 143 #endif // !defined(OS_IOS) && !defined(ADDRESS_SANITIZER) |
138 | 144 |
139 } // namespace base | 145 } // namespace base |
OLD | NEW |