From 3d58117d76d720aa780dab0c406e43a942923b52 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Tue, 21 Feb 2023 17:57:26 -0800 Subject: [PATCH] Add logging to testDragAppIconToWorkspaceCell() - add time logs to see what is taking up the most time bug: 269555222 test: presubmit + manually Change-Id: I36e763a42e0d8ebdcca108d9206418e05ab33e8f --- .../android/launcher3/ui/TaplTestsLauncher3.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index 401c25a4cf..2af6cd0975 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -29,7 +29,9 @@ import static org.junit.Assume.assumeTrue; import android.content.Intent; import android.graphics.Point; +import android.os.SystemClock; import android.platform.test.annotations.IwTest; +import android.util.Log; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -520,9 +522,11 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @PortraitLandscape public void testDragAppIconToWorkspaceCell() throws Exception { + long startTime, endTime, elapsedTime; Point[] targets = getCornersAndCenterPositions(); for (Point target : targets) { + startTime = SystemClock.uptimeMillis(); final HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps(); allApps.freeze(); try { @@ -532,12 +536,21 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } // Reset the workspace for the next shortcut creation. initialize(this); + endTime = SystemClock.uptimeMillis(); + elapsedTime = endTime - startTime; + Log.d("testDragAppIconToWorkspaceCellTime", + "Milliseconds taken to drag app icon to workspace cell: " + elapsedTime); } // test to move a shortcut to other cell. final HomeAppIcon launcherTestAppIcon = createShortcutInCenterIfNotExist(APP_NAME); for (Point target : targets) { + startTime = SystemClock.uptimeMillis(); launcherTestAppIcon.dragToWorkspace(target.x, target.y); + endTime = SystemClock.uptimeMillis(); + elapsedTime = endTime - startTime; + Log.d("testDragAppIconToWorkspaceCellTime", + "Milliseconds taken to move shortcut to other cell: " + elapsedTime); } }