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

Unified Diff: android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java

Issue 2687573002: [Android Webview] Refactor LoadUrlTest and work on embedded_test_server custom handler (Closed)
Patch Set: Change AwETS intent class name Created 3 years, 6 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: android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java
diff --git a/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java b/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..4fa67117ba85a0aba7fb767fe1763009564e9983
--- /dev/null
+++ b/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java
@@ -0,0 +1,40 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.android_webview.test;
+
+import android.content.Context;
+
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.net.test.EmbeddedTestServerImpl;
+
+/**
+ * Java bindings for running a net::test_server::EmbeddedTestServer.
+ *
+ * This should not be used directly. Use {@link EmbeddedTestServer} instead.
+ */
+@JNINamespace("android_webview::test")
+public class AwEmbeddedTestServerImpl extends EmbeddedTestServerImpl {
+ /** Create an uninitialized EmbeddedTestServer. */
+ public AwEmbeddedTestServerImpl(Context context) {
+ super(context);
+ }
+
+ /** Add the default handlers and serve files from the provided directory relative to the
+ * external storage directory.
+ *
+ * @param directoryPath The path of the directory from which files should be served, relative
+ * to the external storage directory.
+ */
+ @Override
+ public void addDefaultHandlers(final String directoryPath) {
+ super.addDefaultHandlers(directoryPath);
+ long[] handlers = nativeGetHandlers();
+ for (long handler : handlers) {
+ super.registerRequestHandler(handler);
+ }
+ }
+
+ private static native long[] nativeGetHandlers();
+}

Powered by Google App Engine
This is Rietveld 408576698