Fix SettingsStateTest#testNoWriteForVirtualDevice
The test testReadWriteForDefaultDevice calls SettingsState#insertSettingsLocked which posts messages into a handler with a delay, which causes write operation into a file (to persist settings). SettingsStae#waitForHandler doesn't handle this case, as it immediately posts a message into the handler and waits for it to execute. As a result, the file write operation sometimes happens asynchronously while testNoWriteForVirtualDevice is executing (where we verify that a settings file should not exist for virtual device settings), and this makes the test flaky. To solve this, use a different File object for testNoWriteForVirtualDevice. Test: atest SettingsStateTest#testNoWriteForVirtualDevice Fixes: 413049126 Flag: EXEMPT test fix Change-Id: Ia3eb9a47565c856c98e1929e85e139ddc7982088
Loading
Please register or sign in to comment