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

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

Issue 1085903002: Enable Sdch in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 5 years, 8 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 08406ea6142cac7cf60e0f6f453d16def92a2240..329b48ab273e514a7e930477a6d07b4142863353 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.CalledByNative;
import org.chromium.base.JNINamespace;
/**
@@ -14,6 +16,8 @@ import org.chromium.base.JNINamespace;
*/
@JNINamespace("cronet")
public final class NativeTestServer {
+ private static final ConditionVariable sHostResolverBlock = new ConditionVariable();
+
public static boolean startNativeTestServer(Context context) {
return nativeStartNativeTestServer(
TestFilesInstaller.getInstalledPath(context));
@@ -23,6 +27,19 @@ public final class NativeTestServer {
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) {
+ sHostResolverBlock.close();
+ nativeRegisterHostResolverProc(contextAdapter, isLegacyAPI);
+ sHostResolverBlock.block();
+ }
+
public static String getEchoBodyURL() {
return nativeGetEchoBodyURL();
}
@@ -47,12 +64,24 @@ public final class NativeTestServer {
return nativeGetFileURL(filePath);
}
+ public static String getSdchURL() {
+ return nativeGetSdchURL();
+ }
+
+ @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();
private static native String nativeGetEchoMethodURL();
private static native String nativeGetRedirectToEchoBody();
private static native String nativeGetFileURL(String filePath);
+ private static native String nativeGetSdchURL();
}

Powered by Google App Engine
This is Rietveld 408576698