Merge "Extend list of ciphers in conscrypt perftests" into main am: 8b7799ad02 am: 97546756d5

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3495038

Change-Id: I23d6cff5d19d669c523913eb0972e34dc1fb7ff8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java
index 9e45c4a..bcc0a3b 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java
@@ -112,36 +112,20 @@
         for (EndpointFactory endpointFactory : EndpointFactory.values()) {
             for (ChannelType channelType : ChannelType.values()) {
                 for (PerfTestProtocol protocol : PerfTestProtocol.values()) {
-                    params.add(
-                            new Object[] {
-                                new Config(
-                                        endpointFactory,
-                                        endpointFactory,
-                                        64,
-                                        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
-                                        channelType,
-                                        protocol)
-                            });
-                    params.add(
-                            new Object[] {
-                                new Config(
-                                        endpointFactory,
-                                        endpointFactory,
-                                        512,
-                                        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
-                                        channelType,
-                                        protocol)
-                            });
-                    params.add(
-                            new Object[] {
-                                new Config(
-                                        endpointFactory,
-                                        endpointFactory,
-                                        4096,
-                                        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
-                                        channelType,
-                                        protocol)
-                            });
+                    for (int messageSize : ConscryptParams.messageSizes) {
+                        for (String cipher : ConscryptParams.ciphers) {
+                            params.add(
+                                    new Object[] {
+                                            new Config(
+                                                    endpointFactory,
+                                                    endpointFactory,
+                                                    messageSize,
+                                                    cipher,
+                                                    channelType,
+                                                    protocol)
+                                    });
+                        }
+                    }
                 }
             }
         }
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ConscryptParams.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ConscryptParams.java
new file mode 100644
index 0000000..e5131b8
--- /dev/null
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ConscryptParams.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2025 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.
+ */
+
+package android.conscrypt;
+
+import java.util.List;
+
+public class ConscryptParams {
+    public static final List<String> ciphers = List.of(
+        "TLS_RSA_WITH_AES_128_GCM_SHA256",
+        "TLS_RSA_WITH_AES_256_GCM_SHA384",
+        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
+        "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
+        "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256"
+    );
+
+    public static final List<Integer> messageSizes = List.of(
+        64,
+        512,
+        4096
+    );
+}
\ No newline at end of file
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java
index cd0ac96..341d8e6 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java
@@ -87,11 +87,13 @@
         }
     }
 
+
     public Collection getParams() {
         final List<Object[]> params = new ArrayList<>();
         for (BufferType bufferType : BufferType.values()) {
-            params.add(new Object[] {new Config(bufferType,
-                "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", 100)});
+            for (String cipher : ConscryptParams.ciphers) {
+                params.add(new Object[] {new Config(bufferType, cipher, 100)});
+            }
         }
         return params;
     }
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java
index 1fee218..23b642e 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java
@@ -37,10 +37,10 @@
 import static org.junit.Assert.assertEquals;
 
 import java.nio.ByteBuffer;
-import java.util.Locale;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Locale;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
 import javax.net.ssl.SSLException;
@@ -94,12 +94,11 @@
     public Collection getParams() {
         final List<Object[]> params = new ArrayList<>();
         for (BufferType bufferType : BufferType.values()) {
-            params.add(new Object[] {new Config(bufferType, 64,
-                                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")});
-            params.add(new Object[] {new Config(bufferType, 512,
-                                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")});
-            params.add(new Object[] {new Config(bufferType, 4096,
-                                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")});
+            for (int messageSize : ConscryptParams.messageSizes) {
+                for (String cipher : ConscryptParams.ciphers) {
+                    params.add(new Object[] {new Config(bufferType, messageSize, cipher)});
+                }
+            }
         }
         return params;
     }
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java
index 90a87ce..343bb12 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java
@@ -102,15 +102,12 @@
         final List<Object[]> params = new ArrayList<>();
         for (EndpointFactory endpointFactory : EndpointFactory.values()) {
             for (ChannelType channelType : ChannelType.values()) {
-                params.add(new Object[] {new Config(endpointFactory,
-                    endpointFactory, 64,
-                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)});
-                params.add(new Object[] {new Config(endpointFactory,
-                    endpointFactory, 512,
-                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)});
-                params.add(new Object[] {new Config(endpointFactory,
-                    endpointFactory, 4096,
-                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)});
+                for (int messageSize : ConscryptParams.messageSizes) {
+                    for (String cipher : ConscryptParams.ciphers) {
+                        params.add(new Object[] {new Config(endpointFactory,
+                            endpointFactory, messageSize, cipher, channelType)});
+                    }
+                }
             }
         }
         return params;