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

Commit b3f83ae6 authored by Paul Duffin's avatar Paul Duffin
Browse files

Removed a.t.TestRunner and cleanup a.t.TestPrinter

Part of the work of removing JUnit and dependent android.test classes
from the Android API involves providing a static library that developers
can include in their test applications to ease migration. That library
will be built directly from the source (as opposed to android.jar which
is built from stubs) and so developers will be able to see classes and
methods that are not present in the stubs. This change is one of a
number of similar changes that cleanup the existing non-API code in
order to minimize the additional methods and classes exposed externally.
The basic approach is to remove unused classes and methods, use least
visible access modifier possible and generally minimize the amount of
publicly visible code.

The TestRunner class is not part of the API and is unused anywhere
within Android code (apart from one unused import which is in the
process of being removed) and in TestPrinter.

TestPrinter is not part of the API and its only use of TestRunner is to
implement the TestRunner.TestListener interface. It was safe to stop
TestPrinter from implementing TestRunner.TestListener because the latter
is only called from TestRunner which itself is never used. TestPrinter
was made package private as it is only used from the same package.

One the usages in TestPrinter were removed it was safe to remove
TestRunner.

Bug: 30188076
Test: make checkbuild and ran FrameworkTestRunnerTests
Change-Id: I0f4a6cf1fbec14c4778c6e09b8eabf822802774f
parent 2a637cf9
Loading
Loading
Loading
Loading
+6 −22
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import junit.framework.Test;
import junit.framework.TestListener;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
@@ -34,52 +33,37 @@ import java.util.Set;
 * {@hide} Not needed for 1.0 SDK.
 */
@Deprecated
public class TestPrinter implements TestRunner.Listener, TestListener {
class TestPrinter implements TestListener {

    private String mTag;
    private boolean mOnlyFailures;
    private Set<String> mFailedTests = new HashSet<String>();


    public TestPrinter(String tag, boolean onlyFailures) {
    TestPrinter(String tag, boolean onlyFailures) {
        mTag = tag;
        mOnlyFailures = onlyFailures;
    }

    public void started(String className) {
    private void started(String className) {
        if (!mOnlyFailures) {
            Log.i(mTag, "started: " + className);
        }
    }

    public void finished(String className) {
    private void finished(String className) {
        if (!mOnlyFailures) {
            Log.i(mTag, "finished: " + className);
        }
    }

    public void performance(String className,
            long itemTimeNS, int iterations,
            List<TestRunner.IntermediateTime> intermediates) {
        Log.i(mTag, "perf: " + className + " = " + itemTimeNS + "ns/op (done "
                + iterations + " times)");
        if (intermediates != null && intermediates.size() > 0) {
            int N = intermediates.size();
            for (int i = 0; i < N; i++) {
                TestRunner.IntermediateTime time = intermediates.get(i);
                Log.i(mTag, "  intermediate: " + time.name + " = "
                        + time.timeInNS + "ns");
            }
        }
    }

    public void passed(String className) {
    private void passed(String className) {
        if (!mOnlyFailures) {
            Log.i(mTag, "passed: " + className);
        }
    }

    public void failed(String className, Throwable exception) {
    private void failed(String className, Throwable exception) {
        Log.i(mTag, "failed: " + className);
        Log.i(mTag, "----- begin exception -----");
        Log.i(mTag, "", exception);
+0 −725

File deleted.

Preview size limit exceeded, changes collapsed.