Use binary resource support in robolectric

The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
This commit is contained in:
James Lemieux
2018-12-07 12:56:49 -08:00
committed by Fan Zhang
parent 1f5fab1480
commit f1dade40d2
1005 changed files with 3187 additions and 5478 deletions

View File

@@ -41,10 +41,9 @@ import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.bluetooth.Utils;
import com.android.settings.testutils.shadow.ShadowAudioManager;
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
import com.android.settings.testutils.shadow.ShadowMediaRouter;
import com.android.settingslib.bluetooth.A2dpProfile;
import com.android.settingslib.bluetooth.BluetoothEventManager;
import com.android.settingslib.bluetooth.HearingAidProfile;
@@ -57,6 +56,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowBluetoothDevice;
@@ -64,10 +64,9 @@ import org.robolectric.shadows.ShadowBluetoothDevice;
import java.util.ArrayList;
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {
ShadowAudioManager.class,
ShadowMediaRouter.class,
ShadowBluetoothUtils.class,
ShadowBluetoothDevice.class}
)
@@ -122,7 +121,7 @@ public class MediaOutputPreferenceControllerTest {
mShadowAudioManager = ShadowAudioManager.getShadow();
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalManager;
mLocalBluetoothManager = ShadowBluetoothUtils.getLocalBtManager(mContext);
mLocalBluetoothManager = Utils.getLocalBtManager(mContext);
when(mLocalBluetoothManager.getEventManager()).thenReturn(mBluetoothEventManager);
when(mLocalBluetoothManager.getProfileManager()).thenReturn(mLocalBluetoothProfileManager);