Merge "Shows the details when all the tests finish and fixes the orientation issue."

This commit is contained in:
Maksymilian Osowski
2010-09-02 06:57:50 -07:00
committed by Android (Google) Code Review
3 changed files with 38 additions and 2 deletions

View File

@@ -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"

View File

@@ -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();

View File

@@ -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);