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

Unified Diff: components/cronet/android/test/src/org/chromium/net/NativeTestServer.java

Issue 1650773003: Revert of [Cronet] Get Cronet performance test running again (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: components/cronet/android/test/src/org/chromium/net/NativeTestServer.java
diff --git a/components/cronet/android/test/src/org/chromium/net/NativeTestServer.java b/components/cronet/android/test/src/org/chromium/net/NativeTestServer.java
index 0b09dafa3b540f78b530c717fbf2fc19b19649f3..c6f3efe5658f110f3d963275d8c2d47f0d1829d8 100644
--- a/components/cronet/android/test/src/org/chromium/net/NativeTestServer.java
+++ b/components/cronet/android/test/src/org/chromium/net/NativeTestServer.java
@@ -5,7 +5,9 @@
package org.chromium.net;
import android.content.Context;
+import android.os.ConditionVariable;
+import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
/**
@@ -14,6 +16,8 @@
*/
@JNINamespace("cronet")
public final class NativeTestServer {
+ private static final ConditionVariable sHostResolverBlock = new ConditionVariable();
+
// This variable contains the response body of a request to getSuccessURL().
public static final String SUCCESS_BODY = "this is a text file\n";
@@ -25,6 +29,19 @@
public static void shutdownNativeTestServer() {
nativeShutdownNativeTestServer();
+ }
+
+ /**
+ * Registers customized DNS mapping for {@link NativeTestServer}.
+ * @param contextAdapter native context adapter object that this
+ * mapping should apply to.
+ * @param isLegacyAPI {@code true} if this context adapter is a part of the
+ * old API.
+ */
+ public static void registerHostResolverProc(long contextAdapter, boolean isLegacyAPI) {
+ nativeRegisterHostResolverProc(contextAdapter, isLegacyAPI);
+ sHostResolverBlock.block();
+ sHostResolverBlock.close();
}
public static String getEchoBodyURL() {
@@ -82,8 +99,15 @@
return nativeIsDataReductionProxySupported();
}
+ @CalledByNative
+ private static void onHostResolverProcRegistered() {
+ sHostResolverBlock.open();
+ }
+
private static native boolean nativeStartNativeTestServer(String filePath);
private static native void nativeShutdownNativeTestServer();
+ private static native void nativeRegisterHostResolverProc(
+ long contextAdapter, boolean isLegacyAPI);
private static native String nativeGetEchoBodyURL();
private static native String nativeGetEchoHeaderURL(String header);
private static native String nativeGetEchoAllHeadersURL();

Powered by Google App Engine
This is Rietveld 408576698