Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afc8d7fc authored by Josh Gao's avatar Josh Gao
Browse files

Don't mock FileDescriptor.

Mocking FileDescriptor seems to make internal methods that should never
return null return null, leading to NullPointerExceptions.

Bug: http://b/168345383
Test: atest TcpSocketTrackerTest
Change-Id: I06189ab14419f4cb7787f457e6969bd15b7c7ecd
parent 7c8eac3f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -207,7 +207,6 @@ public class TcpSocketTrackerTest {
    private static final int TEST_NETID2_FWMARK = 0x1A85;
    private static final int NETID_MASK = 0xffff;
    @Mock private TcpSocketTracker.Dependencies mDependencies;
    @Mock private FileDescriptor mMockFd;
    @Mock private INetd mNetd;
    private final Network mNetwork = new Network(TEST_NETID1);
    private final Network mOtherNetwork = new Network(TEST_NETID2);
@@ -226,7 +225,7 @@ public class TcpSocketTrackerTest {
                Log.setWtfHandler((tag, what, system) -> Log.e(tag, what.getMessage(), what));
        when(mDependencies.getNetd()).thenReturn(mNetd);
        when(mDependencies.isTcpInfoParsingSupported()).thenReturn(true);
        when(mDependencies.connectToKernel()).thenReturn(mMockFd);
        when(mDependencies.connectToKernel()).thenReturn(new FileDescriptor());
        when(mDependencies.getDeviceConfigPropertyInt(
                eq(NAMESPACE_CONNECTIVITY),
                eq(CONFIG_TCP_PACKETS_FAIL_PERCENTAGE),