android_packages_modules_Co.../tests/unit/java/com/android/server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Remi NGUYEN VAN d7331e929f Remove "when" usage in ConnectivityServiceTest
"when" is not thread-safe, as it relies on global state to find which
mock was called with the method to mock in its parameters.

This causes flakes where non-test code that interacts with the mock may
be called from another thread between the contents of "when" and the
"when" method another thread, causing UnfinishedStubbingExceptions or
other test errors. In particular
ConnectivityService#getNetworkCapabilitiesInternal was seen to be
wrongly identified as a mocking site for Dependencies.

Replace all usages with doReturn().when(mock).method() syntax, which has
better thread safety since global state is not necessary to tie the
mock, mocked method and return value.

Bug: 195626111
Test: atest ConnectivityServiceTest
Change-Id: I57c5ffb3b3f799fc59c3af4ccb323fb5d6794fad
2021-10-04 17:03:44 +09:00
..
connectivity Adjust some behaviors on PermissionMonitorTest 2021-09-07 09:46:23 +08:00
net Remove ForceAllNetworkTypes from test 2021-09-11 10:45:16 +08:00
ConnectivityServiceTest.java Remove "when" usage in ConnectivityServiceTest 2021-10-04 17:03:44 +09:00
IpSecServiceParameterizedTest.java Re-skip connectivity unit tests before S 2021-06-30 12:00:28 +09:00
IpSecServiceRefcountedResourceTest.java Re-skip connectivity unit tests before S 2021-06-30 12:00:28 +09:00
IpSecServiceTest.java Re-skip connectivity unit tests before S 2021-06-30 12:00:28 +09:00
LegacyTypeTrackerTest.kt Re-skip connectivity unit tests before S 2021-06-30 12:00:28 +09:00
NetIdManagerTest.kt Re-skip connectivity unit tests before S 2021-06-30 12:00:28 +09:00
NetworkManagementServiceTest.java Re-skip connectivity unit tests before S 2021-06-30 12:00:28 +09:00
NsdServiceTest.java Modify Nsd{Service,Manager}Test to conform to its change 2021-09-13 10:18:04 +09:00