Skip to content
Commit 2da2d037 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Add support to lock test method of WmTests by rule

Window manager could execute something on several threads, e.g.
display, animation, ui. And they cannot be stubbed completely
because that might reduce the similarity to the real case.

The test method usually run without synchronization but in the
real world those methods inside the test should be locked. That
may lead to some race condition such as damaging the mocking and
IndexOutOfBoundsException.

This CL introduces a new runner and rule to make sure the test
method and @Before/After are protected by the WM global lock.
Currently the rule only applies to the classes which are known
to have problems. If it looks stable, we can apply the rule to
more classes and remove the scattered synchronization in each
test method.

Bug: 140284973
Test: atest ActivityStarterTests
            ActivityRecordTests
            DisplayWindowSettingsTests
            RootActivityContainerTests
            RecentsAnimationTest
            WindowStateTests

Change-Id: Ib9dc4bb8a9c3c3cbf0b329d0b05e4fdbe14b2e3e
parent 4448c1df
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment