Loading services/core/java/com/android/server/IpSecService.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -208,6 +208,7 @@ public class IpSecService extends IIpSecService.Stub { mBinder.linkToDeath(this, 0); mBinder.linkToDeath(this, 0); } catch (RemoteException e) { } catch (RemoteException e) { binderDied(); binderDied(); e.rethrowFromSystemServer(); } } } } } } Loading tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.eq; Loading Loading @@ -134,11 +135,11 @@ public class IpSecServiceRefcountedResourceTest { IBinder binderMock = mock(IBinder.class); IBinder binderMock = mock(IBinder.class); doThrow(new RemoteException()).when(binderMock).linkToDeath(anyObject(), anyInt()); doThrow(new RemoteException()).when(binderMock).linkToDeath(anyObject(), anyInt()); RefcountedResource<IResource> refcountedResource = getTestRefcountedResource(binderMock); try { getTestRefcountedResource(binderMock); // Verify that cleanup is performed (Spy limitations prevent verification of method calls fail("Expected exception to propogate when binder fails to link to death"); // for binder death scenario; check refcount to determine if cleanup was performed.) } catch (RuntimeException expected) { assertEquals(-1, refcountedResource.mRefCount); } } } @Test @Test Loading Loading
services/core/java/com/android/server/IpSecService.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -208,6 +208,7 @@ public class IpSecService extends IIpSecService.Stub { mBinder.linkToDeath(this, 0); mBinder.linkToDeath(this, 0); } catch (RemoteException e) { } catch (RemoteException e) { binderDied(); binderDied(); e.rethrowFromSystemServer(); } } } } } } Loading
tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.eq; Loading Loading @@ -134,11 +135,11 @@ public class IpSecServiceRefcountedResourceTest { IBinder binderMock = mock(IBinder.class); IBinder binderMock = mock(IBinder.class); doThrow(new RemoteException()).when(binderMock).linkToDeath(anyObject(), anyInt()); doThrow(new RemoteException()).when(binderMock).linkToDeath(anyObject(), anyInt()); RefcountedResource<IResource> refcountedResource = getTestRefcountedResource(binderMock); try { getTestRefcountedResource(binderMock); // Verify that cleanup is performed (Spy limitations prevent verification of method calls fail("Expected exception to propogate when binder fails to link to death"); // for binder death scenario; check refcount to determine if cleanup was performed.) } catch (RuntimeException expected) { assertEquals(-1, refcountedResource.mRefCount); } } } @Test @Test Loading