Chromium Code Reviews| Index: components/cronet/android/test/src/org/chromium/net/CronetTestUtil.java |
| diff --git a/components/cronet/android/test/src/org/chromium/net/CronetTestUtil.java b/components/cronet/android/test/src/org/chromium/net/CronetTestUtil.java |
| index 745d10a57f978f05e834e8a590502ebf634bb096..378334b6c5adbe03ad2d50c2a7a30c85432db452 100644 |
| --- a/components/cronet/android/test/src/org/chromium/net/CronetTestUtil.java |
| +++ b/components/cronet/android/test/src/org/chromium/net/CronetTestUtil.java |
| @@ -4,6 +4,9 @@ |
| package org.chromium.net; |
| +import android.os.ConditionVariable; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.base.annotations.JNINamespace; |
| /** |
| @@ -11,13 +14,28 @@ import org.chromium.base.annotations.JNINamespace; |
| */ |
| @JNINamespace("cronet") |
| public class CronetTestUtil { |
| + private static final ConditionVariable sHostResolverBlock = new ConditionVariable(); |
| + |
| /** |
| - * Start QUIC server on local host. |
| - * @return non-zero QUIC server port number on success or 0 if failed. |
| + * Registers customized DNS mapping for {@link NativeTestServer}. |
|
mef
2016/01/22 16:21:57
It is not only for NativeTestServer.
pauljensen
2016/01/25 02:47:48
Done.
|
| + * @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. |
| + * @param destination host to map to (e.g. 127.0.0.1) |
| */ |
| - public static int startQuicServer() { |
| - return nativeStartQuicServer(); |
| + public static void registerHostResolverProc( |
|
mef
2016/01/22 16:21:57
could it be better to have 2 separate registerHost
pauljensen
2016/01/25 02:47:48
Done.
|
| + long contextAdapter, boolean isLegacyAPI, String destination) { |
| + nativeRegisterHostResolverProc(contextAdapter, isLegacyAPI, destination); |
| + sHostResolverBlock.block(); |
| + sHostResolverBlock.close(); |
| + } |
| + |
| + @CalledByNative |
| + private static void onHostResolverProcRegistered() { |
| + sHostResolverBlock.open(); |
| } |
| - private static native int nativeStartQuicServer(); |
| + private static native void nativeRegisterHostResolverProc( |
| + long contextAdapter, boolean isLegacyAPI, String destination); |
| } |