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

Commit d80035a7 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

Only do prints for network tests that fail

There's a lot of variance in the network tests, but this appears
to save ~1 second when running them all.

Change-Id: I4629f8d123313a5acf3ff076f0a5960719e35f13
parent 182f9abd
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionD
import com.android.systemui.SysuiTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;

@@ -76,6 +79,19 @@ public class NetworkControllerBaseTest extends SysuiTestCase {

    private NetworkCapabilities mNetCapabilities;

    @Rule
    public TestWatcher failWatcher = new TestWatcher() {
        @Override
        protected void failed(Throwable e, Description description) {
            // Print out mNetworkController state if the test fails.
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            mNetworkController.dump(null, pw, null);
            pw.flush();
            Log.d(TAG, sw.toString());
        }
    };

    @Before
    public void setUp() throws Exception {
        mMockWm = mock(WifiManager.class);
@@ -147,15 +163,6 @@ public class NetworkControllerBaseTest extends SysuiTestCase {

    }

    @After
    public void tearDown() throws Exception {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        mNetworkController.dump(null, pw, null);
        pw.flush();
        Log.d(TAG, sw.toString());
    }

    // 2 Bars 3G GSM.
    public void setupDefaultSignal() {
        setIsGsm(true);