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

Unified Diff: net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java

Issue 2043803003: 👔 Reland #2: Move side-loaded test data /sdcard -> /sdcard/gtestdata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase atop https://codereview.chromium.org/2041723006 Created 4 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: net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java
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
index e0e67d58adf09e22dd14a3681f4406535f78abc8..1f43533525856b4444d750a7c0046aa8b4264ab1 100644
--- a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java
+++ b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java
@@ -8,6 +8,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.os.Environment;
import android.os.IBinder;
import android.os.RemoteException;
@@ -194,19 +195,17 @@ public class EmbeddedTestServer {
* On returning, the server is ready for use.
*
* @param context The context in which the server will run.
- * @param directory The directory from which files should be served.
+ * @param directory The directory from which files should be served. This must be
+ * Environment.getExternalStorageDirectory().
* @return The created server.
*/
public static EmbeddedTestServer createAndStartFileServer(Context context, File directory)
throws InterruptedException {
- EmbeddedTestServer server = new EmbeddedTestServer();
- server.initializeNative(context);
- server.serveFilesFromDirectory(directory);
- if (!server.start()) {
- throw new EmbeddedTestServerFailure(
- "Failed to start serving files from " + directory.getPath());
+ // TODO(jbudorick): Update all callers to use createAndStartDefaultServer() directly.
+ if (!directory.equals(Environment.getExternalStorageDirectory())) {
+ throw new IllegalArgumentException("Expected directory to be ExternalStorageDirectory");
}
- return server;
+ return createAndStartDefaultServer(context);
}
/** Create and initialize a server with the default handlers.

Powered by Google App Engine
This is Rietveld 408576698