summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2019-02-20 14:38:50 -0800
committer Vishnu Nair <vishnun@google.com> 2019-02-20 23:02:10 +0000
commitf77d53d73b1d61e6a0231aa9024b0dd333657271 (patch)
tree10917c8fff8753203586ed776b29574e48c8bcc2
parent1ca52f005a2de99fe28396784b03a61ef32b3099 (diff)
Fix AppWindowTokenAnimationTests and add them to presubmit
Tests were failing because the SurfaceControl in TestAppWindowToken was null. Changed the test class to not skip onParentChanged callback. Test: atest AppWindowTokenAnimationTests Bug: 124357362 Change-Id: I7b12b615c9ae5b57997a9a53aa50bff5962ab723
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java12
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java12
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java8
3 files changed, 25 insertions, 7 deletions
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java
index dd5f32d248b7..108ee180b4b7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java
@@ -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);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
index 114eac911bd7..86df23aaa77a 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
@@ -144,7 +144,14 @@ public 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);
}
}
@@ -155,7 +162,7 @@ public 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() {
@@ -163,6 +170,7 @@ public class WindowTestUtils {
}
}, new ComponentName("", ""), false, dc, true /* fillsParent */);
mTargetSdk = Build.VERSION_CODES.CUR_DEVELOPMENT;
+ mSkipOnParentChanged = skipOnParentChanged;
}
TestAppWindowToken(WindowManagerService service, IApplicationToken token,
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index a83bf2af613e..2da858709e59 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -257,10 +257,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;
}