binder: Move no-verify test objects to libbinder_tls_test_utils

... so that it can be used in fuzzer.

Test: pass
Bug: 195598155
Change-Id: If71af5f70b2477b93d692878d59d98cfe3aaec14
diff --git a/libs/binder/tests/binderRpcBenchmark.cpp b/libs/binder/tests/binderRpcBenchmark.cpp
index f8b1686..6bf6e92 100644
--- a/libs/binder/tests/binderRpcBenchmark.cpp
+++ b/libs/binder/tests/binderRpcBenchmark.cpp
@@ -49,6 +49,7 @@
 using android::RpcAuthPreSigned;
 using android::RpcCertificateFormat;
 using android::RpcCertificateVerifier;
+using android::RpcCertificateVerifierNoOp;
 using android::RpcServer;
 using android::RpcSession;
 using android::RpcTransportCtxFactory;
@@ -89,13 +90,6 @@
         Transport::RPC_TLS,
 };
 
-// Certificate validation happens during handshake and does not affect the result of benchmarks.
-// Skip certificate validation to simplify the setup process.
-class RpcCertificateVerifierNoOp : public RpcCertificateVerifier {
-public:
-    status_t verify(const SSL*, uint8_t*) override { return OK; }
-};
-
 std::unique_ptr<RpcTransportCtxFactory> makeFactoryTls() {
     auto pkey = android::makeKeyPairForSelfSignedCert();
     CHECK_NE(pkey.get(), nullptr);
@@ -108,6 +102,8 @@
 }
 
 static sp<RpcSession> gSession = RpcSession::make();
+// Certificate validation happens during handshake and does not affect the result of benchmarks.
+// Skip certificate validation to simplify the setup process.
 static sp<RpcSession> gSessionTls = RpcSession::make(makeFactoryTls());
 #ifdef __BIONIC__
 static const String16 kKernelBinderInstance = String16(u"binderRpcBenchmark-control");
diff --git a/libs/binder/tests/include_tls_test_utils/binder/RpcTlsTestUtils.h b/libs/binder/tests/include_tls_test_utils/binder/RpcTlsTestUtils.h
index e65883d..cbf11bf 100644
--- a/libs/binder/tests/include_tls_test_utils/binder/RpcTlsTestUtils.h
+++ b/libs/binder/tests/include_tls_test_utils/binder/RpcTlsTestUtils.h
@@ -16,11 +16,13 @@
 
 #pragma once
 
+#include <memory>
 #include <mutex>
 
 #include <binder/RpcAuth.h>
 #include <binder/RpcCertificateFormat.h>
 #include <binder/RpcCertificateVerifier.h>
+#include <binder/RpcTransport.h>
 #include <openssl/ssl.h>
 #include <utils/Errors.h>
 
@@ -75,4 +77,10 @@
     std::vector<bssl::UniquePtr<X509>> mTrustedPeerCertificates;
 };
 
+// A RpcCertificateVerifier that does not verify anything.
+class RpcCertificateVerifierNoOp : public RpcCertificateVerifier {
+public:
+    status_t verify(const SSL*, uint8_t*) override { return OK; }
+};
+
 } // namespace android