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 1f43533525856b4444d750a7c0046aa8b4264ab1..e0e67d58adf09e22dd14a3681f4406535f78abc8 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,7 +8,6 @@ |
import android.content.Context; |
import android.content.Intent; |
import android.content.ServiceConnection; |
-import android.os.Environment; |
import android.os.IBinder; |
import android.os.RemoteException; |
@@ -195,17 +194,19 @@ |
* 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. This must be |
- * Environment.getExternalStorageDirectory(). |
+ * @param directory The directory from which files should be served. |
* @return The created server. |
*/ |
public static EmbeddedTestServer createAndStartFileServer(Context context, File directory) |
throws InterruptedException { |
- // TODO(jbudorick): Update all callers to use createAndStartDefaultServer() directly. |
- if (!directory.equals(Environment.getExternalStorageDirectory())) { |
- throw new IllegalArgumentException("Expected directory to be ExternalStorageDirectory"); |
- } |
- return createAndStartDefaultServer(context); |
+ EmbeddedTestServer server = new EmbeddedTestServer(); |
+ server.initializeNative(context); |
+ server.serveFilesFromDirectory(directory); |
+ if (!server.start()) { |
+ throw new EmbeddedTestServerFailure( |
+ "Failed to start serving files from " + directory.getPath()); |
+ } |
+ return server; |
} |
/** Create and initialize a server with the default handlers. |