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

Commit 13dbe5b1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "BinaryTransparencyServiceTest: Avoid schedule()" into tm-dev am: 8cc6ed54 am: ca8a806d

parents 76881928 ca8a806d
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,10 @@


package com.android.server;
package com.android.server;


import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;

import android.app.job.JobScheduler;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
@@ -43,13 +47,15 @@ public class BinaryTransparencyServiceTest {


    @Before
    @Before
    public void setUp() {
    public void setUp() {
        mContext = ApplicationProvider.getApplicationContext();
        mContext = spy(ApplicationProvider.getApplicationContext());
        mBinaryTransparencyService = new BinaryTransparencyService(mContext);
        mBinaryTransparencyService = new BinaryTransparencyService(mContext);
        mTestInterface = mBinaryTransparencyService.new BinaryTransparencyServiceImpl();
        mTestInterface = mBinaryTransparencyService.new BinaryTransparencyServiceImpl();
    }
    }


    private void prepSignedInfo() {
    private void prepSignedInfo() {
        // simulate what happens on boot completed phase
        // simulate what happens on boot completed phase
        // but we avoid calling JobScheduler.schedule by returning a null.
        doReturn(null).when(mContext).getSystemService(JobScheduler.class);
        mBinaryTransparencyService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
        mBinaryTransparencyService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
    }
    }