1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org
.chromium
.net
;
7 import android
.content
.Context
;
9 import org
.chromium
.base
.JNINamespace
;
12 * Wrapper class to start an in-process native test server, and get URLs
13 * needed to talk to it.
15 @JNINamespace("cronet")
16 public final class NativeTestServer
{
17 public static boolean startNativeTestServer(Context context
) {
18 return nativeStartNativeTestServer(
19 TestFilesInstaller
.getInstalledPath(context
));
22 public static void shutdownNativeTestServer() {
23 nativeShutdownNativeTestServer();
26 public static String
getEchoBodyURL() {
27 return nativeGetEchoBodyURL();
30 public static String
getEchoHeaderURL(String header
) {
31 return nativeGetEchoHeaderURL(header
);
34 public static String
getEchoAllHeadersURL() {
35 return nativeGetEchoAllHeadersURL();
38 public static String
getEchoMethodURL() {
39 return nativeGetEchoMethodURL();
42 public static String
getRedirectToEchoBody() {
43 return nativeGetRedirectToEchoBody();
46 public static String
getFileURL(String filePath
) {
47 return nativeGetFileURL(filePath
);
50 private static native boolean nativeStartNativeTestServer(String filePath
);
51 private static native void nativeShutdownNativeTestServer();
52 private static native String
nativeGetEchoBodyURL();
53 private static native String
nativeGetEchoHeaderURL(String header
);
54 private static native String
nativeGetEchoAllHeadersURL();
55 private static native String
nativeGetEchoMethodURL();
56 private static native String
nativeGetRedirectToEchoBody();
57 private static native String
nativeGetFileURL(String filePath
);