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

Commit f742c599 authored by Mady Mellor's avatar Mady Mellor
Browse files

Maybe avoid NPE in tear down

Flag: EXEMPT test fix
Test: atest BubblesTest
Bug: 400121407
Change-Id: I0442f7e00d81248547cf22b41c401dbe33e04e79
parent 4ba96e93
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -204,8 +204,6 @@ import com.android.wm.shell.taskview.TaskViewRepository;
import com.android.wm.shell.taskview.TaskViewTransitions;
import com.android.wm.shell.transition.Transitions;

import kotlin.Lazy;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -216,9 +214,6 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;

import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -227,6 +222,10 @@ import java.util.List;
import java.util.Optional;
import java.util.concurrent.Executor;

import kotlin.Lazy;
import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@@ -606,11 +605,13 @@ public class BubblesTest extends SysuiTestCase {

    @After
    public void tearDown() throws Exception {
        if (mBubbleData != null) {
            ArrayList<Bubble> bubbles = new ArrayList<>(mBubbleData.getBubbles());
            for (int i = 0; i < bubbles.size(); i++) {
                mBubbleController.removeBubble(bubbles.get(i).getKey(),
                        Bubbles.DISMISS_NO_LONGER_BUBBLE);
            }
        }
        mTestableLooper.processAllMessages();

        // check that no animations are running before finishing the test to make sure that the