diff options
author | borenet <borenet@google.com> | 2015-09-02 06:04:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-02 06:04:29 -0700 |
commit | e5a38f0ad22d2c65c3f5b568a88a0b7224ad62d8 (patch) | |
tree | 6c3d859722322f650a9f063aee2ffee7b4b44012 /platform_tools/android/apps | |
parent | a3710c32623c23347b7e09e3e9e559dd8429287e (diff) |
VisualBenchTest: Read nanobench_flags.txt
BUG=skia:4093
Review URL: https://codereview.chromium.org/1314873005
Diffstat (limited to 'platform_tools/android/apps')
-rw-r--r-- | platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchTestActivity.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchTestActivity.java b/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchTestActivity.java index 2edd816306..48507bea68 100644 --- a/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchTestActivity.java +++ b/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchTestActivity.java @@ -11,6 +11,11 @@ import android.app.Instrumentation; import android.content.Intent; import android.test.ActivityUnitTestCase; import android.util.Log; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.lang.StringBuilder; public class VisualBenchTestActivity extends ActivityUnitTestCase<VisualBenchActivity> { private VisualBenchActivity mActivity; @@ -25,11 +30,26 @@ public class VisualBenchTestActivity extends ActivityUnitTestCase<VisualBenchAct mInstrumentation = getInstrumentation(); } - public void testVisualBench() throws InterruptedException { + private String getFlags() throws IOException { + InputStream s = getInstrumentation().getTargetContext().getResources().getAssets().open("nanobench_flags.txt"); + BufferedReader r = new BufferedReader(new InputStreamReader(s)); + StringBuilder flags = new StringBuilder(); + String sep = System.getProperty("line.separator"); + String line; + while ((line = r.readLine()) != null) { + flags.append(line); + flags.append(sep); + } + s.close(); + return flags.toString(); + } + + public void testVisualBench() throws InterruptedException, IOException { String pkg = getInstrumentation().getTargetContext().getPackageName(); Intent intent = new Intent(getInstrumentation().getTargetContext(), VisualBenchActivity.class); - intent.putExtra("cmdLineFlags", "--outResultsFile /sdcard/skia_results/visualbench.json"); + String args = getFlags(); + intent.putExtra("cmdLineFlags", args); mActivity = launchActivityWithIntent(pkg, VisualBenchActivity.class, intent); assertNotNull("mActivity is null", mActivity); |