Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
|
jbudorick
2017/03/09 02:00:47
nit: This shouldn't be android_webview/embeddedtes
shenghuazhang
2017/03/13 18:48:15
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.net.test; | |
| 6 | |
| 7 import android.content.Context; | |
| 8 | |
| 9 import java.util.concurrent.Callable; | |
| 10 | |
| 11 /** | |
| 12 * Java bindings for running a net::test_server::EmbeddedTestServer. | |
| 13 * | |
| 14 * This should not be used directly. Use {@link EmbeddedTestServer} instead. | |
| 15 */ | |
| 16 public class AwEmbeddedTestServerImpl extends EmbeddedTestServerImpl { | |
| 17 /** Create an uninitialized EmbeddedTestServer. */ | |
| 18 public AwEmbeddedTestServerImpl(Context context) { | |
|
jbudorick
2017/03/09 02:00:47
I think this can be omitted.
shenghuazhang
2017/03/13 18:48:15
Hmm...Actually it would reveal constructor error w
| |
| 19 super(context); | |
| 20 } | |
| 21 /** Add the default handlers and serve files from the provided directory rel ative to the | |
| 22 * external storage directory. | |
| 23 * | |
| 24 * @param directoryPath The path of the directory from which files should b e served, relative | |
| 25 * to the external storage directory. | |
| 26 */ | |
| 27 @Override | |
| 28 public void addDefaultHandlers(final String directoryPath) { | |
| 29 runOnHandlerThread(new Callable<Void>() { | |
| 30 @Override | |
| 31 public Void call() { | |
| 32 nativeAddDefaultHandlers(mNativeEmbeddedTestServer, directoryPat h); | |
| 33 CustomHandlers custom_handlers = new CustomHandlers(); | |
| 34 long[] handlers = custom_handlers.getHandlers(); | |
| 35 for (long h : handlers) { | |
| 36 nativeRegisterRequestHandler(mNativeEmbeddedTestServer, h); | |
| 37 } | |
| 38 return null; | |
| 39 } | |
| 40 }); | |
| 41 } | |
| 42 } | |
| OLD | NEW |