summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Maksymilian Osowski <maxosowski@google.com> 2010-09-02 03:19:37 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-09-02 03:19:37 -0700
commit4cf63e57ac5dbc1e376a7d5d2ba4a59cbbb585c5 (patch)
tree4b2631b1d1185fa208eff515cee82cbb9fe0d945
parent9cefc6482b868ccd9001a0ea6a3aa528622597ed (diff)
parentff314d7094fdc6a1869d6cbe17db16c5b9129009 (diff)
Merge "Added "run all tests in the current directory" menu option."
-rw-r--r--tests/DumpRenderTree2/res/menu/gui_menu.xml20
-rw-r--r--tests/DumpRenderTree2/res/values/strings.xml2
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java43
3 files changed, 53 insertions, 12 deletions
diff --git a/tests/DumpRenderTree2/res/menu/gui_menu.xml b/tests/DumpRenderTree2/res/menu/gui_menu.xml
new file mode 100644
index 000000000000..a5b2b65e3cb4
--- /dev/null
+++ b/tests/DumpRenderTree2/res/menu/gui_menu.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2010 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/run_all"
+ android:title="@string/run_all_tests" />
+</menu> \ No newline at end of file
diff --git a/tests/DumpRenderTree2/res/values/strings.xml b/tests/DumpRenderTree2/res/values/strings.xml
index 5fd1eb9a5b40..049640418761 100644
--- a/tests/DumpRenderTree2/res/values/strings.xml
+++ b/tests/DumpRenderTree2/res/values/strings.xml
@@ -25,4 +25,6 @@ limitations under the License.
<string name="dialog_progress_msg">Please wait...</string>
<string name="runner_preloading_title">Preloading tests...</string>
+
+ <string name="run_all_tests">Run all tests in the current directory</string>
</resources> \ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
index 2280c665ba44..b1862efa80fd 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
@@ -35,6 +35,9 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -205,11 +208,7 @@ public class DirListActivity extends ListActivity {
showDir(item.getRelativePath());
} else {
/** Run the test */
- Intent intent = new Intent();
- intent.setClass(DirListActivity.this, TestsListActivity.class);
- intent.setAction(Intent.ACTION_RUN);
- intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, item.getRelativePath());
- startActivity(intent);
+ runAllTestsUnder(item.getRelativePath());
}
}
});
@@ -236,6 +235,32 @@ public class DirListActivity extends ListActivity {
showDir("");
}
+ private void runAllTestsUnder(String relativePath) {
+ Intent intent = new Intent();
+ intent.setClass(DirListActivity.this, TestsListActivity.class);
+ intent.setAction(Intent.ACTION_RUN);
+ intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, relativePath);
+ startActivity(intent);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.gui_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.run_all:
+ runAllTestsUnder(mCurrentDirPath);
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
@Override
/**
* Moves to the parent directory if one exists. Does not allow to move above
@@ -278,13 +303,7 @@ public class DirListActivity extends ListActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
removeDialog(DIALOG_RUN_ABORT_DIR);
- /** Run the tests */
- Intent intent = new Intent();
- intent.setClass(DirListActivity.this, TestsListActivity.class);
- intent.setAction(Intent.ACTION_RUN);
- intent.putExtra(TestsListActivity.EXTRA_TEST_PATH,
- args.getString("relativePath"));
- startActivity(intent);
+ runAllTestsUnder(args.getString("relativePath"));
}
});