OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.ConditionVariable; | 8 import android.os.ConditionVariable; |
9 | 9 |
10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
11 import org.chromium.base.JNINamespace; | 11 import org.chromium.base.JNINamespace; |
12 import org.chromium.base.Log; | 12 import org.chromium.base.Log; |
13 | 13 |
14 /** | 14 /** |
15 * Wrapper class to start a Quic test server. | 15 * Wrapper class to start a Quic test server. |
16 */ | 16 */ |
17 @JNINamespace("cronet") | 17 @JNINamespace("cronet") |
18 public final class QuicTestServer { | 18 public final class QuicTestServer { |
19 private static final ConditionVariable sBlock = new ConditionVariable(); | 19 private static final ConditionVariable sBlock = new ConditionVariable(); |
20 private static final String TAG = Log.makeTag("QuicTestServer"); | 20 private static final String TAG = "cr.QuicTestServer"; |
21 | 21 |
22 public static void startQuicTestServer(Context context) { | 22 public static void startQuicTestServer(Context context) { |
23 TestFilesInstaller.installIfNeeded(context); | 23 TestFilesInstaller.installIfNeeded(context); |
24 nativeStartQuicTestServer(TestFilesInstaller.getInstalledPath(context)); | 24 nativeStartQuicTestServer(TestFilesInstaller.getInstalledPath(context)); |
25 sBlock.block(); | 25 sBlock.block(); |
26 } | 26 } |
27 | 27 |
28 public static void shutdownQuicTestServer() { | 28 public static void shutdownQuicTestServer() { |
29 nativeShutdownQuicTestServer(); | 29 nativeShutdownQuicTestServer(); |
30 sBlock.close(); | 30 sBlock.close(); |
(...skipping 15 matching lines...) Expand all Loading... |
46 private static void onServerStarted() { | 46 private static void onServerStarted() { |
47 Log.i(TAG, "Quic server started."); | 47 Log.i(TAG, "Quic server started."); |
48 sBlock.open(); | 48 sBlock.open(); |
49 } | 49 } |
50 | 50 |
51 private static native void nativeStartQuicTestServer(String filePath); | 51 private static native void nativeStartQuicTestServer(String filePath); |
52 private static native void nativeShutdownQuicTestServer(); | 52 private static native void nativeShutdownQuicTestServer(); |
53 private static native String nativeGetServerHost(); | 53 private static native String nativeGetServerHost(); |
54 private static native int nativeGetServerPort(); | 54 private static native int nativeGetServerPort(); |
55 } | 55 } |
OLD | NEW |