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

Commit d4bf5dfd authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Fix flaky history job service test" into main

parents 6e2cdc93 097a5edb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Context;
import android.os.CancellationSignal;
import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.server.LocalServices;

import java.util.concurrent.TimeUnit;
@@ -77,5 +78,11 @@ public class NotificationHistoryJobService extends JobService {
        }
        return false;
    }

    @Override
    @VisibleForTesting
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -71,10 +71,10 @@ public class NotificationHistoryJobServiceTest extends UiServiceTestCase {
    @Before
    public void setUp() throws Exception {
        mJobService = new NotificationHistoryJobService();
        mJobService.attachBaseContext(mContext);
        mJobService.onCreate();
        mJobService.onBind(/* intent= */ null);  // Create JobServiceEngine within JobService.

        final Field field = JobService.class.getDeclaredField("mEngine");
        field.setAccessible(true);
        field.set(mJobService, mock(JobServiceEngine.class));
        mContext.addMockSystemService(JobScheduler.class, mMockJobScheduler);

        // add NotificationManagerInternal to LocalServices