Loading services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java +12 −12 Original line number Diff line number Diff line Loading @@ -40,27 +40,25 @@ import android.view.SurfaceControl; import android.view.SurfaceSession; import android.view.View; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.annotations.GuardedBy; import com.android.server.LocalServices; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import androidx.test.filters.SmallTest; /** * Tests for the {@link DragDropController} class. * * Build/Install/Run: * atest FrameworksServicesTests:com.android.server.wm.DragDropControllerTests */ @SmallTest @RunWith(AndroidJUnit4.class) @Presubmit public class DragDropControllerTests extends WindowTestsBase { private static final int TIMEOUT_MS = 3000; Loading Loading @@ -109,6 +107,7 @@ public class DragDropControllerTests extends WindowTestsBase { return window; } @Override @Before public void setUp() throws Exception { final UserManagerInternal userManager = mock(UserManagerInternal.class); Loading @@ -127,6 +126,7 @@ public class DragDropControllerTests extends WindowTestsBase { } } @Override @After public void tearDown() throws Exception { LocalServices.removeServiceForTest(UserManagerInternal.class); Loading @@ -139,25 +139,25 @@ public class DragDropControllerTests extends WindowTestsBase { mTarget.cancelDragAndDrop(mToken); } latch = new CountDownLatch(1); mTarget.setOnClosedCallbackLocked(() -> { latch.countDown(); }); mTarget.setOnClosedCallbackLocked(latch::countDown); } assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); super.tearDown(); } @Test public void testDragFlow() throws Exception { public void testDragFlow() { dragFlow(0, ClipData.newPlainText("label", "Test"), 0, 0); } @Test public void testPerformDrag_NullDataWithGrantUri() throws Exception { public void testPerformDrag_NullDataWithGrantUri() { dragFlow(View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_READ, null, 0, 0); } @Test public void testPerformDrag_NullDataToOtherUser() throws Exception { public void testPerformDrag_NullDataToOtherUser() { final WindowState otherUsersWindow = createDropTargetWindow("Other user's window", 1 * UserHandle.PER_USER_RANGE); doReturn(otherUsersWindow).when(mDisplayContent).getTouchableWinAtPointLocked(10, 10); Loading services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java +7 −2 Original line number Diff line number Diff line Loading @@ -29,14 +29,14 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.os.UserManager; import androidx.test.InstrumentationRegistry; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import java.io.File; import androidx.test.InstrumentationRegistry; /** * Base class for tests that use a {@link TaskSnapshotPersister}. */ Loading @@ -54,9 +54,11 @@ class TaskSnapshotPersisterTestBase extends WindowTestsBase { sFilesDir = InstrumentationRegistry.getContext().getFilesDir(); } @Override @Before public void setUp() throws Exception { super.setUp(); final UserManager um = UserManager.get(InstrumentationRegistry.getContext()); mTestUserId = um.getUserHandle(); mPersister = new TaskSnapshotPersister(userId -> sFilesDir); Loading @@ -64,9 +66,12 @@ class TaskSnapshotPersisterTestBase extends WindowTestsBase { mPersister.start(); } @Override @After public void tearDown() throws Exception { cleanDirectory(); super.tearDown(); } private void cleanDirectory() { Loading services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java +8 −6 Original line number Diff line number Diff line Loading @@ -25,30 +25,29 @@ import static org.junit.Assert.assertTrue; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import androidx.test.filters.SmallTest; /** * Tests for the {@link DisplayContent.TaskStackContainers} container in {@link DisplayContent}. * * Build/Install/Run: * bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests * atest FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests */ @SmallTest @Presubmit @RunWith(AndroidJUnit4.class) public class TaskStackContainersTests extends WindowTestsBase { private TaskStack mPinnedStack; @Override @Before public void setUp() throws Exception { super.setUp(); mPinnedStack = createStackControllerOnStackOnDisplay( WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD, mDisplayContent).mContainer; // Stack should contain visible app window to be considered visible. Loading @@ -60,9 +59,12 @@ public class TaskStackContainersTests extends WindowTestsBase { assertTrue(mPinnedStack.isVisible()); } @Override @After public void tearDown() throws Exception { mPinnedStack.removeImmediately(); super.tearDown(); } @Test Loading Loading
services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java +12 −12 Original line number Diff line number Diff line Loading @@ -40,27 +40,25 @@ import android.view.SurfaceControl; import android.view.SurfaceSession; import android.view.View; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.annotations.GuardedBy; import com.android.server.LocalServices; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import androidx.test.filters.SmallTest; /** * Tests for the {@link DragDropController} class. * * Build/Install/Run: * atest FrameworksServicesTests:com.android.server.wm.DragDropControllerTests */ @SmallTest @RunWith(AndroidJUnit4.class) @Presubmit public class DragDropControllerTests extends WindowTestsBase { private static final int TIMEOUT_MS = 3000; Loading Loading @@ -109,6 +107,7 @@ public class DragDropControllerTests extends WindowTestsBase { return window; } @Override @Before public void setUp() throws Exception { final UserManagerInternal userManager = mock(UserManagerInternal.class); Loading @@ -127,6 +126,7 @@ public class DragDropControllerTests extends WindowTestsBase { } } @Override @After public void tearDown() throws Exception { LocalServices.removeServiceForTest(UserManagerInternal.class); Loading @@ -139,25 +139,25 @@ public class DragDropControllerTests extends WindowTestsBase { mTarget.cancelDragAndDrop(mToken); } latch = new CountDownLatch(1); mTarget.setOnClosedCallbackLocked(() -> { latch.countDown(); }); mTarget.setOnClosedCallbackLocked(latch::countDown); } assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); super.tearDown(); } @Test public void testDragFlow() throws Exception { public void testDragFlow() { dragFlow(0, ClipData.newPlainText("label", "Test"), 0, 0); } @Test public void testPerformDrag_NullDataWithGrantUri() throws Exception { public void testPerformDrag_NullDataWithGrantUri() { dragFlow(View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_READ, null, 0, 0); } @Test public void testPerformDrag_NullDataToOtherUser() throws Exception { public void testPerformDrag_NullDataToOtherUser() { final WindowState otherUsersWindow = createDropTargetWindow("Other user's window", 1 * UserHandle.PER_USER_RANGE); doReturn(otherUsersWindow).when(mDisplayContent).getTouchableWinAtPointLocked(10, 10); Loading
services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java +7 −2 Original line number Diff line number Diff line Loading @@ -29,14 +29,14 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.os.UserManager; import androidx.test.InstrumentationRegistry; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import java.io.File; import androidx.test.InstrumentationRegistry; /** * Base class for tests that use a {@link TaskSnapshotPersister}. */ Loading @@ -54,9 +54,11 @@ class TaskSnapshotPersisterTestBase extends WindowTestsBase { sFilesDir = InstrumentationRegistry.getContext().getFilesDir(); } @Override @Before public void setUp() throws Exception { super.setUp(); final UserManager um = UserManager.get(InstrumentationRegistry.getContext()); mTestUserId = um.getUserHandle(); mPersister = new TaskSnapshotPersister(userId -> sFilesDir); Loading @@ -64,9 +66,12 @@ class TaskSnapshotPersisterTestBase extends WindowTestsBase { mPersister.start(); } @Override @After public void tearDown() throws Exception { cleanDirectory(); super.tearDown(); } private void cleanDirectory() { Loading
services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java +8 −6 Original line number Diff line number Diff line Loading @@ -25,30 +25,29 @@ import static org.junit.Assert.assertTrue; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import androidx.test.filters.SmallTest; /** * Tests for the {@link DisplayContent.TaskStackContainers} container in {@link DisplayContent}. * * Build/Install/Run: * bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests * atest FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests */ @SmallTest @Presubmit @RunWith(AndroidJUnit4.class) public class TaskStackContainersTests extends WindowTestsBase { private TaskStack mPinnedStack; @Override @Before public void setUp() throws Exception { super.setUp(); mPinnedStack = createStackControllerOnStackOnDisplay( WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD, mDisplayContent).mContainer; // Stack should contain visible app window to be considered visible. Loading @@ -60,9 +59,12 @@ public class TaskStackContainersTests extends WindowTestsBase { assertTrue(mPinnedStack.isVisible()); } @Override @After public void tearDown() throws Exception { mPinnedStack.removeImmediately(); super.tearDown(); } @Test Loading