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

Unified Diff: mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java

Issue 1189703004: Reland: Build Mojo apps in sub-dirs, like application packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup, move getAssetsList to FileHelper; rename local to cached. Created 5 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
« no previous file with comments | « mojo/runner/android/apk/src/org/chromium/mojo/shell/ShellMain.java ('k') | mojo/runner/context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java
diff --git a/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java b/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java
index 18037adfa490279b22c83fa8cf5252ecdb8ece8a..bb576725c5da9c8a91d97a2a44b47145b712b6e2 100644
--- a/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java
+++ b/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java
@@ -5,10 +5,10 @@
package org.chromium.mojo.shell;
import android.content.Context;
-import android.content.res.AssetManager;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
+import org.chromium.base.Log;
import java.io.File;
import java.io.IOException;
@@ -18,24 +18,24 @@ import java.io.IOException;
*/
@JNINamespace("mojo::runner::test")
public class ShellTestBase {
- // Directory where applications bundled with the tests will be extracted.
- private static final String TEST_APP_DIRECTORY = "test_apps";
+ private static final String TAG = "ShellTestBase";
/**
* Extracts the mojo applications from the apk assets and returns the directory where they are.
*/
@CalledByNative
private static String extractMojoApplications(Context context) throws IOException {
- final File outputDirectory = context.getDir(TEST_APP_DIRECTORY, Context.MODE_PRIVATE);
-
- AssetManager manager = context.getResources().getAssets();
- for (String asset : manager.list("")) {
- if (asset.endsWith(".mojo")) {
+ File cachedAppsDir = FileHelper.getCachedAppsDir(context);
+ try {
+ FileHelper.prepareDirectoryForAssets(context, cachedAppsDir);
+ for (String assetPath : FileHelper.getAssetsList(context)) {
FileHelper.extractFromAssets(
- context, asset, outputDirectory, FileHelper.FileType.PERMANENT);
+ context, assetPath, cachedAppsDir, FileHelper.FileType.PERMANENT);
}
+ } catch (Exception e) {
+ Log.e(TAG, "ShellTestBase initialization failed.", e);
+ throw new RuntimeException(e);
}
-
- return outputDirectory.getAbsolutePath();
+ return cachedAppsDir.getAbsolutePath();
}
}
« no previous file with comments | « mojo/runner/android/apk/src/org/chromium/mojo/shell/ShellMain.java ('k') | mojo/runner/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698