Revert "Simplifying model testing rules"
Revert submission 32704934-model-test-cleanup Reason for revert: Droidmonitor created revert due to b/406588406. Will be verifying through ABTD before submission. Reverted changes: /q/submissionid:32704934-model-test-cleanup Change-Id: Ieeb7f5b5699afeae27f946f060147bb68afc36e5
This commit is contained in:
committed by
Android (Google) Code Review
parent
cb84230913
commit
35b6d322ab
+19
-16
@@ -20,7 +20,6 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
|
||||
import static com.android.launcher3.util.LauncherModelHelper.TEST_ACTIVITY;
|
||||
import static com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE;
|
||||
import static com.android.launcher3.util.ModelTestExtensions.getBgDataModel;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
@@ -33,18 +32,15 @@ import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherModel;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.util.LauncherLayoutBuilder;
|
||||
import com.android.launcher3.util.ModelTestExtensions;
|
||||
import com.android.launcher3.util.SandboxApplication;
|
||||
import com.android.launcher3.util.rule.LayoutProviderRule;
|
||||
import com.android.launcher3.util.LauncherModelHelper;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -57,11 +53,23 @@ import java.util.List;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class DefaultLayoutProviderTest {
|
||||
|
||||
@Rule public SandboxApplication mTargetContext = new SandboxApplication().withModelDependency();
|
||||
@Rule public LayoutProviderRule mLayoutProvider = new LayoutProviderRule(mTargetContext);
|
||||
private LauncherModelHelper mModelHelper;
|
||||
private LauncherModelHelper.SandboxModelContext mTargetContext;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mModelHelper = new LauncherModelHelper();
|
||||
mTargetContext = mModelHelper.sandboxContext;
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mModelHelper.destroy();
|
||||
}
|
||||
|
||||
private List<ItemInfo> getWorkspaceItems() {
|
||||
return getBgDataModel(getModel())
|
||||
return mModelHelper
|
||||
.getBgDataModel()
|
||||
.itemsIdMap
|
||||
.stream()
|
||||
.filter(i -> i.container == CONTAINER_DESKTOP || i.container == CONTAINER_HOTSEAT)
|
||||
@@ -169,11 +177,6 @@ public class DefaultLayoutProviderTest {
|
||||
}
|
||||
|
||||
private void writeLayoutAndLoad(LauncherLayoutBuilder builder) throws Exception {
|
||||
mLayoutProvider.setupDefaultLayoutProvider(builder);
|
||||
ModelTestExtensions.INSTANCE.loadModelSync(getModel());
|
||||
}
|
||||
|
||||
private LauncherModel getModel() {
|
||||
return LauncherAppState.getInstance(mTargetContext).getModel();
|
||||
mModelHelper.setupDefaultLayoutProvider(builder).loadModelSync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user