Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment