diff options
3 files changed, 38 insertions, 2 deletions
diff --git a/tests/DumpRenderTree2/AndroidManifest.xml b/tests/DumpRenderTree2/AndroidManifest.xml index dd0c4e9f416a..b4dc190fa8d9 100644 --- a/tests/DumpRenderTree2/AndroidManifest.xml +++ b/tests/DumpRenderTree2/AndroidManifest.xml @@ -35,7 +35,8 @@ limitations under the License. It can lead to some weird behaviour in the future. --> <activity android:name=".TestsListActivity" android:label="Tests' list activity" - android:launchMode="singleTask"> + android:launchMode="singleTask" + android:configChanges="orientation"> </activity> <activity android:name=".LayoutTestsExecutor" diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java index 94ba35f88a89..5c10776b0ae2 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java @@ -27,6 +27,7 @@ import com.android.dumprendertree2.forwarder.ForwarderManager; import java.io.File; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -200,6 +201,11 @@ public class Summarizer { mResultsRootDirPath = resultsRootDirPath; } + public static URI getDetailsUri() { + return new File(ManagerService.RESULTS_ROOT_DIR_PATH + File.separator + + HTML_DETAILS_RELATIVE_PATH).toURI(); + } + public void appendTest(AbstractResult result) { String relativePath = result.getRelativePath(); diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java index 4965fd9cc6e4..9db4d2bd14aa 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java @@ -19,10 +19,14 @@ package com.android.dumprendertree2; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; +import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Message; +import android.view.Gravity; import android.view.Window; +import android.webkit.WebView; +import android.widget.Toast; import com.android.dumprendertree2.scriptsupport.OnEverythingFinishedCallback; @@ -124,13 +128,38 @@ public class TestsListActivity extends Activity { } private void onEverythingFinishedIntent(Intent intent) { - /** TODO: Show some kind of summary to the user */ + Toast toast = Toast.makeText(this, + "All tests finished.\nPress back key to return to the tests' list.", + Toast.LENGTH_LONG); + toast.setGravity(Gravity.CENTER, -40, 0); + toast.show(); + + /** Show the details to the user */ + WebView webView = new WebView(this); + webView.getSettings().setJavaScriptEnabled(true); + webView.getSettings().setBuiltInZoomControls(true); + webView.getSettings().setEnableSmoothTransition(true); + /** This enables double-tap to zoom */ + webView.getSettings().setUseWideViewPort(true); + + setContentView(webView); + webView.loadUrl(Summarizer.getDetailsUri().toString()); + mEverythingFinished = true; if (mOnEverythingFinishedCallback != null) { mOnEverythingFinishedCallback.onFinished(); } } + /** + * This, together with android:configChanges="orientation" in manifest file, prevents + * the activity from restarting on orientation change. + */ + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + } + @Override protected void onSaveInstanceState(Bundle outState) { outState.putStringArrayList("testsList", mTestsList); |