summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger Huang <tigerhuang@google.com> 2020-02-11 17:43:12 +0800
committer Tiger Huang <tigerhuang@google.com> 2020-02-11 17:43:12 +0800
commitc88227fee755b8db2bea36afe282d8fe1dfde6af (patch)
tree6cb73dd361cf2de67afad09c4248ccf3642f92ca
parenta00008934115e91bb0a41b67c16268763f35ee6e (diff)
Test more about InsetsSourceProvider.updateControlForTarget
We added logic to the function, and this CL detects if the logic is broken. Bug; 149121559 Test: atest InsetsSourceProviderTest Change-Id: I5eadae67aa0c2555441b16d8ae0146fe18ad0632
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java b/services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java
index 7ffdd7cdceb6..f8117573efdd 100644
--- a/services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java
@@ -112,11 +112,44 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
final WindowState target = createWindow(null, TYPE_APPLICATION, "target");
statusBar.getFrameLw().set(0, 0, 500, 100);
+
+ // We must not have control or control target before we have the insets source window.
+ mProvider.updateControlForTarget(target, true /* force */);
+ assertNull(mProvider.getControl(target));
+ assertNull(mProvider.getControlTarget());
+
+ // We can have the control or the control target after we have the insets source window.
mProvider.setWindow(statusBar, null, null);
mProvider.updateControlForTarget(target, false /* force */);
assertNotNull(mProvider.getControl(target));
+ assertNotNull(mProvider.getControlTarget());
+
+ // We must not have control or control target while we are performing seamless rotation.
+ // And the control and the control target must not be updated during that.
+ mProvider.startSeamlessRotation();
+ assertNull(mProvider.getControl(target));
+ assertNull(mProvider.getControlTarget());
+ mProvider.updateControlForTarget(target, true /* force */);
+ assertNull(mProvider.getControl(target));
+ assertNull(mProvider.getControlTarget());
+
+ // We can have the control and the control target after seamless rotation.
+ mProvider.finishSeamlessRotation(false /* timeout */);
+ mProvider.updateControlForTarget(target, false /* force */);
+ assertNotNull(mProvider.getControl(target));
+ assertNotNull(mProvider.getControlTarget());
+
+ // We can clear the control and the control target.
mProvider.updateControlForTarget(null, false /* force */);
assertNull(mProvider.getControl(target));
+ assertNull(mProvider.getControlTarget());
+
+ // We must not have control or control target if the insets source window doesn't have a
+ // surface.
+ statusBar.setSurfaceControl(null);
+ mProvider.updateControlForTarget(target, true /* force */);
+ assertNull(mProvider.getControl(target));
+ assertNull(mProvider.getControlTarget());
}
@Test