1 // Copyright 2015 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.base.task.test; 6 7 import org.robolectric.annotation.Implementation; 8 import org.robolectric.annotation.Implements; 9 10 import org.chromium.base.task.AsyncTask; 11 12 import java.util.concurrent.Executor; 13 14 /** 15 * Forces async tasks to execute with the default executor. 16 * This works around Robolectric not working out of the box with custom executors. 17 * 18 * @param <Result> 19 */ 20 @Implements(AsyncTask.class) 21 public class CustomShadowAsyncTask<Result> extends ShadowAsyncTask<Result> { 22 @Override 23 @Implementation executeOnExecutor(Executor executor)24 public final AsyncTask<Result> executeOnExecutor(Executor executor) { 25 return super.executeInRobolectric(); 26 } 27 } 28