summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNataniel Borges <natanieljr@google.com>2020-11-30 17:11:29 +0100
committerNataniel Borges <natanieljr@google.com>2020-12-01 14:19:08 +0100
commit4c465faa858dfda6b32a8acf8f16401177d0f819 (patch)
tree49a6c1aec02a5d0ecf2dab517ba8be9be95370c7
parent3a9b54f70487cd139c9c4d1bf740cf30a3564aba (diff)
Make current WM tests compatible with new Layers object
Previously the test relied on the proto object, now it uses the properties from the flicker layer class for better compatiblity Test: atest ResizeTasksSyncTest Change-Id: I6cca7fc39d3f87182a83cc57c852fd2cd0894594
-rw-r--r--tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt2
-rw-r--r--tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt18
2 files changed, 8 insertions, 12 deletions
diff --git a/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt b/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt
index cd4b38516bc3..a6d3d8f56b92 100644
--- a/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt
+++ b/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt
@@ -23,7 +23,7 @@ import android.util.Log
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.android.server.wm.flicker.monitor.LayersTraceMonitor
import com.android.server.wm.flicker.monitor.withSFTracing
-import com.android.server.wm.flicker.traces.layers.LayersTrace
+import com.android.server.wm.traces.parser.layers.LayersTrace
import junit.framework.Assert
import org.junit.After
import org.junit.Before
diff --git a/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt b/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt
index fe9deae80407..42cb552d1b9c 100644
--- a/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt
+++ b/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt
@@ -77,17 +77,13 @@ class ResizeTasksSyncTest {
}
// find the frame which match resized buffer size.
- var frame: Long = -1
- loop@ for (trace in trace.entries) {
- for (layer in trace.flattenedLayers) {
- if (layer.proto.activeBuffer != null &&
- layer.proto.activeBuffer.width == firstBounds.width() &&
- layer.proto.activeBuffer.height == firstBounds.height()) {
- frame = layer.proto.currFrame
- break@loop
- }
- }
- }
+ val frame = trace.entries.flatMap { it.flattenedLayers }
+ .firstOrNull { layer ->
+ !layer.isActiveBufferEmpty &&
+ layer.activeBuffer?.width == firstBounds.width() &&
+ layer.activeBuffer?.height == firstBounds.height()
+ }?.currFrame ?: -1
+
assertNotEquals(-1, frame)
// layer bounds should be related to parent surfaceview.
secondBounds.offsetTo(0, 0)