summaryrefslogtreecommitdiffstats
path: root/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-17 11:39:22 +0100
committerSteve Block <steveblock@google.com>2010-09-17 13:21:22 +0100
commit8a6def02473ee4fbffcd1b34173daf751d316202 (patch)
treea3d43e26ebb52c6b569edfb0bb1ea191712ab695 /tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
parentc0847c55eaef5b91d91abfdcfee5650eb22866eb (diff)
downloadframeworks_base-8a6def02473ee4fbffcd1b34173daf751d316202.zip
frameworks_base-8a6def02473ee4fbffcd1b34173daf751d316202.tar.gz
frameworks_base-8a6def02473ee4fbffcd1b34173daf751d316202.tar.bz2
Update DumpRenderTree2 to handle failing tests where no meaningful diff is available
Currently, DumpRenderTree2 asigns the following result codes {PASS, FAIL_RESULT_DIFFERS, FAIL_NO_EXPECTED_RESULT, FAIL_TIMED_OUT, FAIL_CRASHED} This is not strictly correct, as a test may fail for any of three reasons - crashing, timing out, or the the result not being as expected. Therefore, it's possible for a test to fail even if the result is as expected. This patch updates AbstractResult to handle each of the three reasons for failure separately. We then test all three to determine if the test has passed. This allows us to correctly report whether or not the result differs from expected for a failing test. Change-Id: I7adcfe72c4dd0bd3de2e1b868d9807be6eb5bddf
Diffstat (limited to 'tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java')
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java52
1 files changed, 44 insertions, 8 deletions
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
index 7cbb397..6048338a 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
@@ -46,12 +46,14 @@ public abstract class AbstractResult implements Comparable<AbstractResult> {
public abstract AbstractResult createResult(Bundle bundle);
}
+ /**
+ * A code representing the result of comparing actual and expected results.
+ */
public enum ResultCode {
- PASS("Passed"),
- FAIL_RESULT_DIFFERS("Result differs"),
- FAIL_NO_EXPECTED_RESULT("No expected result"),
- FAIL_TIMED_OUT("Timed out"),
- FAIL_CRASHED("Crashed");
+ RESULTS_MATCH("Results match"),
+ RESULTS_DIFFER("Results differ"),
+ NO_EXPECTED_RESULT("No expected result"),
+ NO_ACTUAL_RESULT("No actual result");
private String mTitle;
@@ -123,14 +125,48 @@ public abstract class AbstractResult implements Comparable<AbstractResult> {
public abstract String getActualTextResult();
/**
- * Returns the code of this result.
+ * Returns the status code representing the result of comparing actual and expected results.
*
* @return
- * the code of this result
+ * the status code from comparing actual and expected results
*/
public abstract ResultCode getResultCode();
/**
+ * Returns whether this test crashed.
+ *
+ * @return
+ * whether this test crashed
+ */
+ public abstract boolean didCrash();
+
+ /**
+ * Returns whether this test timed out.
+ *
+ * @return
+ * whether this test timed out
+ */
+ public abstract boolean didTimeOut();
+
+ /**
+ * Sets that this test timed out.
+ */
+ public abstract void setDidTimeOut();
+
+ /**
+ * Returns whether the test passed.
+ *
+ * @return
+ * whether the test passed
+ */
+ public boolean didPass() {
+ // Tests that crash can't have timed out or have an actual result.
+ assert !(didCrash() && didTimeOut());
+ assert !(didCrash() && getResultCode() != ResultCode.NO_ACTUAL_RESULT);
+ return !didCrash() && !didTimeOut() && getResultCode() == ResultCode.RESULTS_MATCH;
+ }
+
+ /**
* Return the type of the result data.
*
* @return
@@ -150,4 +186,4 @@ public abstract class AbstractResult implements Comparable<AbstractResult> {
public abstract String getDiffAsHtml();
public abstract Bundle getBundle();
-} \ No newline at end of file
+}