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

Unified Diff: base/native_library_unittest.cc

Issue 2042103002: Clean up some nits in base::NativeLibrary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: base/native_library_unittest.cc
diff --git a/base/native_library_unittest.cc b/base/native_library_unittest.cc
index b3cff1d79e3b55281a5222b3e72c364768f077f7..237a46fa2e7d740e3d83ead5f6475ef8e38d043b 100644
--- a/base/native_library_unittest.cc
+++ b/base/native_library_unittest.cc
@@ -4,6 +4,7 @@
#include "base/files/file_path.h"
#include "base/native_library.h"
+#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -13,17 +14,28 @@ const FilePath::CharType kDummyLibraryPath[] =
TEST(NativeLibraryTest, LoadFailure) {
NativeLibraryLoadError error;
- NativeLibrary library =
- LoadNativeLibrary(FilePath(kDummyLibraryPath), &error);
- EXPECT_TRUE(library == nullptr);
+ EXPECT_FALSE(LoadNativeLibrary(FilePath(kDummyLibraryPath), &error));
EXPECT_FALSE(error.ToString().empty());
}
// |error| is optional and can be null.
TEST(NativeLibraryTest, LoadFailureWithNullError) {
- NativeLibrary library =
- LoadNativeLibrary(FilePath(kDummyLibraryPath), nullptr);
- EXPECT_TRUE(library == nullptr);
+ EXPECT_FALSE(LoadNativeLibrary(FilePath(kDummyLibraryPath), nullptr));
+}
+
+TEST(NativeLibraryTest, GetNativeLibraryName) {
+ const char kExpectedName[] =
+#if defined(OS_IOS)
+ "mylib";
+#elif defined(OS_MACOSX)
+ "mylib.dylib";
+#elif defined(OS_POSIX)
+ "libmylib.so";
+#elif defined(OS_WIN)
+ "mylib.dll";
+#endif
+ EXPECT_EQ(ASCIIToUTF16(kExpectedName),
+ GetNativeLibraryName(ASCIIToUTF16("mylib")));
}
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698