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
This commit is contained in:
Nataniel Borges
2020-11-30 17:11:29 +01:00
parent 3a9b54f704
commit 4c465faa85
2 changed files with 8 additions and 12 deletions

View File

@@ -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

View File

@@ -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)