summaryrefslogtreecommitdiff
path: root/libcutils/native_handle_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-11-12 20:20:42 -0800
committerElliott Hughes <enh@google.com>2019-11-12 20:23:55 -0800
commit7e424846107bfd345d1a217af09ec95392844d67 (patch)
tree4fe2e357d43a39fc329d9684395c54cedd149238 /libcutils/native_handle_test.cpp
parent0bc3f6b124c22477f052245c6461bd254b374dd3 (diff)
Ignore nullptr in native_handle_close().
Just like native_handle_delete(). Bug: http://b/143898343 Test: new test Change-Id: I373067aa6c2b03548b218c7011bdbf23bd71f260
Diffstat (limited to 'libcutils/native_handle_test.cpp')
-rw-r--r--libcutils/native_handle_test.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/libcutils/native_handle_test.cpp b/libcutils/native_handle_test.cpp
new file mode 100644
index 000000000..c1e2f0be3
--- /dev/null
+++ b/libcutils/native_handle_test.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cutils/native_handle.h>
+
+#include <gtest/gtest.h>
+
+TEST(native_handle, native_handle_delete) {
+ ASSERT_EQ(0, native_handle_delete(nullptr));
+}
+
+TEST(native_handle, native_handle_close) {
+ ASSERT_EQ(0, native_handle_close(nullptr));
+}