Fixing Robolectic model tests
Some tests were broken because of refactoring in LauncherModel. Change-Id: I55aa32d75a4d16338796a1b1765717fd72ba4b33
This commit is contained in:
1 parent
c32e39f1db
commit
986ea0da60
8 files changed
+38
-27
No files matched your search
@@ -30,6 +30,7 @@ import com.android.launcher3.PagedView;
|
||||
import com.android.launcher3.model.BgDataModel.Callbacks;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.shadows.ShadowLooperExecutor;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.LauncherLayoutBuilder;
|
||||
import com.android.launcher3.util.LauncherModelHelper;
|
||||
@@ -43,8 +44,8 @@ import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.LooperMode;
|
||||
import org.robolectric.annotation.LooperMode.Mode;
|
||||
import org.robolectric.shadow.api.Shadow;
|
||||
import org.robolectric.shadows.ShadowPackageManager;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -74,7 +75,8 @@ public class ModelMultiCallbacksTest {
|
||||
// Since robolectric tests run on main thread, we run the loader-UI calls on a temp thread,
|
||||
// so that we can wait appropriately for the loader to complete.
|
||||
mTempMainExecutor = new LooperExecutor(createAndStartNewForegroundLooper("tempMain"));
|
||||
ReflectionHelpers.setField(mModelHelper.getModel(), "mMainExecutor", mTempMainExecutor);
|
||||
ShadowLooperExecutor sle = Shadow.extract(Executors.MAIN_EXECUTOR);
|
||||
sle.setHandler(mTempMainExecutor.getHandler());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user