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

Commit 57d03473 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix AppWindowTokenAnimationTests and add them to presubmit"

parents 0d40e2de f77d53d7
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -27,10 +27,9 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;

import android.platform.test.annotations.Presubmit;
import android.view.SurfaceControl;

import androidx.test.filters.SmallTest;

import com.android.server.wm.WindowTestUtils.TestAppWindowToken;

import org.junit.Before;
@@ -39,13 +38,18 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;

/**
 * Animation related tests for the {@link AppWindowToken} class.
 *
 * Build/Install/Run:
 *  atest FrameworksServicesTests:AppWindowTokenAnimationTests
 *  atest AppWindowTokenAnimationTests
 */
@SmallTest
@Presubmit
@FlakyTest(bugId = 124357362)
public class AppWindowTokenAnimationTests extends WindowTestsBase {

    private TestAppWindowToken mToken;
@@ -60,7 +64,7 @@ public class AppWindowTokenAnimationTests extends WindowTestsBase {
        MockitoAnnotations.initMocks(this);

        mToken = createTestAppWindowToken(mDisplayContent, WINDOWING_MODE_FULLSCREEN,
                ACTIVITY_TYPE_STANDARD);
                ACTIVITY_TYPE_STANDARD, false /* skipOnParentChanged */);
        mToken.setPendingTransaction(mTransaction);
    }

+10 −2
Original line number Diff line number Diff line
@@ -57,7 +57,14 @@ class WindowTestUtils {

    static TestAppWindowToken createTestAppWindowToken(DisplayContent dc) {
        synchronized (dc.mWmService.mGlobalLock) {
            return new TestAppWindowToken(dc);
            return new TestAppWindowToken(dc, true /* skipOnParentChanged */);
        }
    }

    static TestAppWindowToken createTestAppWindowToken(DisplayContent dc,
            boolean skipOnParentChanged) {
        synchronized (dc.mWmService.mGlobalLock) {
            return new TestAppWindowToken(dc, skipOnParentChanged);
        }
    }

@@ -68,7 +75,7 @@ class WindowTestUtils {
        private Transaction mPendingTransactionOverride;
        boolean mSkipOnParentChanged = true;

        private TestAppWindowToken(DisplayContent dc) {
        private TestAppWindowToken(DisplayContent dc, boolean skipOnParentChanged) {
            super(dc.mWmService, new IApplicationToken.Stub() {
                @Override
                public String getName() {
@@ -76,6 +83,7 @@ class WindowTestUtils {
                }
            }, new ComponentName("", ""), false, dc, true /* fillsParent */);
            mTargetSdk = Build.VERSION_CODES.CUR_DEVELOPMENT;
            mSkipOnParentChanged = skipOnParentChanged;
        }

        int getWindowsCount() {
+7 −1
Original line number Diff line number Diff line
@@ -256,10 +256,16 @@ class WindowTestsBase {

    WindowTestUtils.TestAppWindowToken createTestAppWindowToken(DisplayContent dc, int
            windowingMode, int activityType) {
        return createTestAppWindowToken(dc, windowingMode, activityType,
                true /*skipOnParentChanged */);
    }

    WindowTestUtils.TestAppWindowToken createTestAppWindowToken(DisplayContent dc, int
            windowingMode, int activityType, boolean skipOnParentChanged) {
        final TaskStack stack = createTaskStackOnDisplay(windowingMode, activityType, dc);
        final Task task = createTaskInStack(stack, 0 /* userId */);
        final WindowTestUtils.TestAppWindowToken appWindowToken =
                WindowTestUtils.createTestAppWindowToken(dc);
                WindowTestUtils.createTestAppWindowToken(dc, skipOnParentChanged);
        task.addChild(appWindowToken, 0);
        return appWindowToken;
    }