summaryrefslogtreecommitdiffstats
path: root/net/test/android
diff options
context:
space:
mode:
authorjbudorick <jbudorick@chromium.org>2015-06-25 08:45:35 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-25 15:46:00 +0000
commit6a6cb7e15a0b04ad92199ac1e5fb5b694adc8db6 (patch)
tree67dc3e9942ad973d18f279793cab502edb01da2e /net/test/android
parenta2fa4fff9920822973ec0958008ae68dbc2d5dd3 (diff)
downloadchromium_src-6a6cb7e15a0b04ad92199ac1e5fb5b694adc8db6.zip
chromium_src-6a6cb7e15a0b04ad92199ac1e5fb5b694adc8db6.tar.gz
chromium_src-6a6cb7e15a0b04ad92199ac1e5fb5b694adc8db6.tar.bz2
Revert of [Android] Add a Java version of net::test_server::EmbeddedTestServer. (patchset #7 id:120001 of https://codereview.chromium.org/1174613002/)
Reason for revert: broke main waterfall: http://build.chromium.org/p/chromium/builders/Android/builds/42187 Original issue's description: > [Android] Add a Java version of net::test_server::EmbeddedTestServer. > > Notably, this CL does not: > - convert ChromeInstrumentationTestRunner's TestHttpServer to use this > - convert cronet's NativeTestServer to use this > > Those can be done separately. > > BUG=488192 > > Committed: https://crrev.com/d58755d3bb7ead19d8ad909e4455b14857fe6d10 > Cr-Commit-Position: refs/heads/master@{#336159} TBR=mef@chromium.org,yfriedman@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=488192 Review URL: https://codereview.chromium.org/1210973002 Cr-Commit-Position: refs/heads/master@{#336165}
Diffstat (limited to 'net/test/android')
-rw-r--r--net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java111
-rw-r--r--net/test/android/net_test_jni_onload.cc40
-rw-r--r--net/test/android/net_test_jni_onload.h19
3 files changed, 0 insertions, 170 deletions
diff --git a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java
deleted file mode 100644
index 06ab79e..0000000
--- a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2015 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.net.test;
-
-import org.chromium.base.CalledByNative;
-import org.chromium.base.JNINamespace;
-
-import java.io.File;
-
-/**
- * Java bindings for the native embedded test server.
- *
- * An example use:
- * EmbeddedTestServer s = new EmbeddedTestServer();
- * s.initializeNative();
- * s.serveFilesFromDirectory("/path/to/my/directory");
- * if (!s.initializeAndWaitUntilReady()) {
- * throw new SomeKindOfException("Unable to initialize EmbeddedTestServer.");
- * }
- *
- * // serve requests...
- *
- * s.shutdownAndWait();
- * s.destroy();
- */
-@JNINamespace("net::test_server")
-public class EmbeddedTestServer {
- private long mNativeEmbeddedTestServer;
-
- /** Create an uninitialized EmbeddedTestServer. */
- public EmbeddedTestServer() {}
-
- /** Initialize the native EmbeddedTestServer object. */
- public void initializeNative() {
- if (mNativeEmbeddedTestServer == 0) nativeInit();
- assert mNativeEmbeddedTestServer != 0;
- }
-
- /** Serve files from the provided directory.
- *
- * @param directory The directory from which files should be served.
- */
- public void serveFilesFromDirectory(File directory) {
- nativeServeFilesFromDirectory(mNativeEmbeddedTestServer, directory.getPath());
- }
-
- /** Serve files from the provided directory.
- *
- * @param directoryPath The path of the directory from which files should be served.
- */
- public void serveFilesFromDirectory(String directoryPath) {
- nativeServeFilesFromDirectory(mNativeEmbeddedTestServer, directoryPath);
- }
-
- /** Initialize the server.
- *
- * Note that this should be called after handlers are set up, including any relevant calls
- * serveFilesFromDirectory.
- *
- * @return Whether the server was successfully initialized.
- */
- public boolean initializeAndWaitUntilReady() {
- return nativeInitializeAndWaitUntilReady(mNativeEmbeddedTestServer);
- }
-
- /** Get the full URL for the given relative URL.
- *
- * @param relativeUrl The relative URL for which a full URL will be obtained.
- * @return The URL as a String.
- */
- public String getURL(String relativeUrl) {
- return nativeGetURL(mNativeEmbeddedTestServer, relativeUrl);
- }
-
- /** Shutdown the server.
- *
- * @return Whether the server was successfully shut down.
- */
- public boolean shutdownAndWaitUntilComplete() {
- return nativeShutdownAndWaitUntilComplete(mNativeEmbeddedTestServer);
- }
-
- /** Destroy the native EmbeddedTestServer object. */
- public void destroy() {
- assert mNativeEmbeddedTestServer != 0;
- nativeDestroy(mNativeEmbeddedTestServer);
- assert mNativeEmbeddedTestServer == 0;
- }
-
- @CalledByNative
- private void setNativePtr(long nativePtr) {
- assert mNativeEmbeddedTestServer == 0;
- mNativeEmbeddedTestServer = nativePtr;
- }
-
- @CalledByNative
- private void clearNativePtr() {
- assert mNativeEmbeddedTestServer != 0;
- mNativeEmbeddedTestServer = 0;
- }
-
- private native void nativeInit();
- private native void nativeDestroy(long nativeEmbeddedTestServerAndroid);
- private native boolean nativeInitializeAndWaitUntilReady(long nativeEmbeddedTestServerAndroid);
- private native boolean nativeShutdownAndWaitUntilComplete(long nativeEmbeddedTestServerAndroid);
- private native String nativeGetURL(long nativeEmbeddedTestServerAndroid, String relativeUrl);
- private native void nativeServeFilesFromDirectory(
- long nativeEmbeddedTestServerAndroid, String directoryPath);
-}
diff --git a/net/test/android/net_test_jni_onload.cc b/net/test/android/net_test_jni_onload.cc
deleted file mode 100644
index ac54b1f..0000000
--- a/net/test/android/net_test_jni_onload.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2015 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.
-
-#include "net/test/android/net_test_jni_onload.h"
-
-#include "base/android/base_jni_onload.h"
-#include "base/bind.h"
-#include "net/test/embedded_test_server/android/embedded_test_server_android.h"
-
-namespace net {
-namespace test {
-
-namespace {
-
-bool RegisterJNI(JNIEnv* env) {
- return net::test_server::EmbeddedTestServerAndroid::
- RegisterEmbeddedTestServerAndroid(env);
-}
-
-bool Init() {
- return true;
-}
-
-} // namesapce
-
-bool OnJNIOnLoadRegisterJNI(JavaVM* vm) {
- std::vector<base::android::RegisterCallback> register_callbacks;
- register_callbacks.push_back(base::Bind(&RegisterJNI));
- return base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks);
-}
-
-bool OnJNIOnLoadInit() {
- std::vector<base::android::InitCallback> init_callbacks;
- init_callbacks.push_back(base::Bind(&Init));
- return base::android::OnJNIOnLoadInit(init_callbacks);
-}
-
-} // namespace test
-} // namespace net
diff --git a/net/test/android/net_test_jni_onload.h b/net/test/android/net_test_jni_onload.h
deleted file mode 100644
index 67d139a..0000000
--- a/net/test/android/net_test_jni_onload.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef NET_TEST_ANDROID_NET_TEST_JNI_ONLOAD_H_
-#define NET_TEST_ANDROID_NET_TEST_JNI_ONLOAD_H_
-
-#include <jni.h>
-
-namespace net {
-namespace test {
-
-bool OnJNIOnLoadRegisterJNI(JavaVM* vm);
-bool OnJNIOnLoadInit();
-
-} // namespace test
-} // namespace net
-
-#endif // NET_TEST_ANDROID_NET_TEST_JNI_ONLOAD_H_