Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbba4ae2 authored by Maksymilian Osowski's avatar Maksymilian Osowski Committed by Android (Google) Code Review
Browse files

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

parents 84daaf8b 1b034781
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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"
+6 −0
Original line number Diff line number Diff line
@@ -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();

+30 −1
Original line number Diff line number Diff line
@@ -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);