| 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();
|
|
|