summaryrefslogtreecommitdiffstats
path: root/tests/DumpRenderTree2/src
diff options
context:
space:
mode:
authorMaksymilian Osowski <maxosowski@google.com>2010-08-10 11:33:10 +0100
committerMaksymilian Osowski <maxosowski@google.com>2010-08-10 14:47:53 +0100
commitc8fb818b947f15d4eb467c229ea43806dd75c01e (patch)
tree190fed69a1f61850f42406cea48d0014bb1dadb6 /tests/DumpRenderTree2/src
parent8aff3c0571f078b0b212bd283278791ebc478da5 (diff)
downloadframeworks_base-c8fb818b947f15d4eb467c229ea43806dd75c01e.zip
frameworks_base-c8fb818b947f15d4eb467c229ea43806dd75c01e.tar.gz
frameworks_base-c8fb818b947f15d4eb467c229ea43806dd75c01e.tar.bz2
Changed some parts of the code to prepare it for script support that will come in later commit.
Bug: 2903591 Change-Id: If8fcfad1557c8140c476212d8be9f99987cdaa18
Diffstat (limited to 'tests/DumpRenderTree2/src')
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java8
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java20
2 files changed, 21 insertions, 7 deletions
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
index 3bbfb89..a8695a0 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
@@ -93,6 +93,11 @@ public class ManagerService extends Service {
case MSG_ALL_TESTS_FINISHED:
mSummarizer.summarize();
+ Intent intent = new Intent(ManagerService.this, TestsListActivity.class);
+ intent.setAction(Intent.ACTION_SHUTDOWN);
+ /** This flag is needed because we send the intent from the service */
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
break;
}
}
@@ -166,7 +171,8 @@ public class ManagerService extends Service {
Intent intent = new Intent(this, TestsListActivity.class);
intent.setAction(Intent.ACTION_REBOOT);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ /** This flag is needed because we send the intent from the service */
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("crashedTestIndex", mCurrentlyRunningTestIndex);
startActivity(intent);
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
index c21463b..982fe10 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
@@ -85,6 +85,15 @@ public class TestsListActivity extends Activity {
new TestsListPreloaderThread(path, doneMsg).start();
}
+ @Override
+ protected void onNewIntent(Intent intent) {
+ if (intent.getAction().equals(Intent.ACTION_REBOOT)) {
+ onCrashIntent(intent);
+ } else if (intent.getAction().equals(Intent.ACTION_SHUTDOWN)) {
+ onEverythingFinishedIntent(intent);
+ }
+ }
+
/**
* This method handles an intent that comes from ManageService when crash is detected.
* The intent contains an index in mTestsList of the test that crashed. TestsListActivity
@@ -94,18 +103,17 @@ public class TestsListActivity extends Activity {
* LayoutTestExecutor runs then as usual, sending reports to ManagerService. If it
* detects the crash it sends a new intent and the flow repeats.
*/
- @Override
- protected void onNewIntent(Intent intent) {
- if (!intent.getAction().equals(Intent.ACTION_REBOOT)) {
- return;
- }
-
+ private void onCrashIntent(Intent intent) {
int nextTestToRun = intent.getIntExtra("crashedTestIndex", -1) + 1;
if (nextTestToRun > 0 && nextTestToRun <= mTotalTestCount) {
restartExecutor(nextTestToRun);
}
}
+ private void onEverythingFinishedIntent(Intent intent) {
+ /** TODO: Show some kind of summary to the user */
+ }
+
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putStringArrayList("testsList", mTestsList);