[Android] Update SDK version for some tests.
Some tests specify that they need to run with a specific SDK version.
This CL makes them target a newer SDK version.
Bug: 1255748
Change-Id: I9cb59307f5adb56c929e8fd9de0722ec78c73617
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3219774
Commit-Queue: Tommy Nyquist <[email protected]>
Reviewed-by: Reilly Grant <[email protected]>
Reviewed-by: Ben joyce <[email protected]>
Reviewed-by: Mohamed Heikal <[email protected]>
Reviewed-by: Julian Pastarmov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#931299}
diff --git a/DEPS b/DEPS
index ce4bf04..c63fbe02 100644
--- a/DEPS
+++ b/DEPS
@@ -1535,7 +1535,7 @@
'packages': [
{
'package': 'chromium/third_party/robolectric',
- 'version': 'iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC',
+ 'version': 'Kdd6dNFAKqj9g9Bsfo2z1zQr52Vk60EL_wb9Bf2c8rcC',
},
],
'condition': 'checkout_android',
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperTest.java
index a654ad0..c98e11a 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperTest.java
@@ -9,6 +9,7 @@
import static org.mockito.Mockito.when;
import android.app.Activity;
+import android.os.Build;
import android.text.TextUtils;
import org.junit.Before;
@@ -35,7 +36,7 @@
/** Tests for {@link StripLayoutHelper}. */
@RunWith(BaseRobolectricTestRunner.class)
-@Config(manifest = Config.NONE, sdk = 21)
+@Config(manifest = Config.NONE, sdk = Build.VERSION_CODES.M)
public class StripLayoutHelperTest {
@Mock private LayoutUpdateHost mUpdateHost;
@Mock private LayoutRenderHost mRenderHost;
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CloseButtonNavigatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CloseButtonNavigatorTest.java
index 3fbcdad..deb2ec5 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CloseButtonNavigatorTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CloseButtonNavigatorTest.java
@@ -16,6 +16,8 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.os.Build;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -50,9 +52,8 @@
* Tests for {@link CloseButtonNavigator}.
*/
@RunWith(ParameterizedRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class CloseButtonNavigatorTest {
-
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {{true}, {false}});
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java
index 3420bba..6072b55b 100644
--- a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java
+++ b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java
@@ -91,7 +91,7 @@
* 2) That no activities have been enabled/disabled.
*/
@Test
- @Config(sdk = Build.VERSION_CODES.LOLLIPOP)
+ @Config(sdk = Build.VERSION_CODES.M)
public void testDeepLinkPreN() {
registerWebApk(true /* isNewStyleWebApk */);
@@ -424,7 +424,7 @@
* - Android API level < N
*/
@Test
- @Config(sdk = Build.VERSION_CODES.LOLLIPOP)
+ @Config(sdk = Build.VERSION_CODES.M)
public void testCheckH2OOpaqueMainActivityEnabledPreN() {
changeWebApkActivityEnabledSetting(mPackageManager, H2OOpaqueMainActivity.class,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
@@ -441,7 +441,7 @@
* - Android API level < N
*/
@Test
- @Config(sdk = Build.VERSION_CODES.LOLLIPOP)
+ @Config(sdk = Build.VERSION_CODES.M)
public void testCheckH2oMainActivityEnabledPreN() {
changeWebApkActivityEnabledSetting(mPackageManager, H2OMainActivity.class,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
@@ -548,7 +548,7 @@
/** Tests that we do not attempt to add a shortcut on Android versions lower than N. */
@Test
- @Config(sdk = Build.VERSION_CODES.LOLLIPOP)
+ @Config(sdk = Build.VERSION_CODES.M)
public void testDoesNotAddSiteSettingsWhenSdkLow() {
registerApkForSiteSettings(true /*enableInMetadata*/, true /*addCategory*/);
diff --git a/chrome/browser/payments/android/java/src/org/chromium/chrome/browser/payments/AutofillContactTest.java b/chrome/browser/payments/android/java/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
index 17346558..8dd3883c 100644
--- a/chrome/browser/payments/android/java/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
+++ b/chrome/browser/payments/android/java/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
@@ -9,6 +9,7 @@
import static org.mockito.Mockito.spy;
import android.content.Context;
+import android.os.Build;
import org.junit.Assert;
import org.junit.Test;
@@ -27,7 +28,7 @@
* Parametrized unit tests for the AutofillContact class.
*/
@RunWith(ParameterizedRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class AutofillContactTest {
@Parameters
public static Collection<Object[]> data() {
diff --git a/components/policy/android/junit/src/org/chromium/components/policy/PolicyConverterTest.java b/components/policy/android/junit/src/org/chromium/components/policy/PolicyConverterTest.java
index a76e27f4..f3f7a7e 100644
--- a/components/policy/android/junit/src/org/chromium/components/policy/PolicyConverterTest.java
+++ b/components/policy/android/junit/src/org/chromium/components/policy/PolicyConverterTest.java
@@ -24,7 +24,7 @@
* Robolectric test for AbstractAppRestrictionsProvider.
*/
@RunWith(BaseRobolectricTestRunner.class)
-@Config(manifest = Config.NONE, sdk = Build.VERSION_CODES.LOLLIPOP)
+@Config(manifest = Config.NONE, sdk = Build.VERSION_CODES.M)
public class PolicyConverterTest {
@Rule
public JniMocker mocker = new JniMocker();
diff --git a/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java b/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java
index 63c5096..5dace77 100644
--- a/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java
+++ b/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java
@@ -24,6 +24,7 @@
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
+import android.os.Build;
import android.os.Handler;
import android.util.SparseArray;
@@ -50,7 +51,7 @@
* Unit tests for PlatformSensor and PlatformSensorProvider.
*/
@RunWith(BaseRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class PlatformSensorAndProviderTest {
@Mock
private Context mContext;
diff --git a/services/device/geolocation/android/junit/src/org/chromium/device/geolocation/LocationProviderTest.java b/services/device/geolocation/android/junit/src/org/chromium/device/geolocation/LocationProviderTest.java
index 55b32c2..53e718e 100644
--- a/services/device/geolocation/android/junit/src/org/chromium/device/geolocation/LocationProviderTest.java
+++ b/services/device/geolocation/android/junit/src/org/chromium/device/geolocation/LocationProviderTest.java
@@ -11,6 +11,7 @@
import android.content.Context;
import android.location.LocationManager;
+import android.os.Build;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.FusedLocationProviderApi;
@@ -41,7 +42,7 @@
* Test suite for Java Geolocation.
*/
@RunWith(ParameterizedRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class LocationProviderTest {
static {
// Setting robolectric.offline which tells Robolectric to look for runtime dependency
diff --git a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
index 6f3cce7..2e0bcb9 100644
--- a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
+++ b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
@@ -29,6 +29,7 @@
import android.nfc.NfcManager;
import android.nfc.Tag;
import android.nfc.tech.TagTechnology;
+import android.os.Build;
import android.os.Bundle;
import org.junit.Before;
@@ -68,7 +69,7 @@
* Unit tests for NfcImpl and NdefMessageUtils classes.
*/
@RunWith(LocalRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class NFCTest {
private TestNfcDelegate mDelegate;
private int mNextWatchId;
diff --git a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NfcBlocklistTest.java b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NfcBlocklistTest.java
index be7b36f..0e76515 100644
--- a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NfcBlocklistTest.java
+++ b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NfcBlocklistTest.java
@@ -7,6 +7,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import android.os.Build;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
@@ -18,7 +20,7 @@
* Unit tests for the {@link NfcBlocklist} class.
*/
@RunWith(BaseRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class NfcBlocklistTest {
// Static historical bytes
private static final byte[] YUBIKEY_NEO_HISTORICAL_BYTES = new byte[] {
diff --git a/services/shape_detection/android/junit/src/org/chromium/shape_detection/BitmapUtilsTest.java b/services/shape_detection/android/junit/src/org/chromium/shape_detection/BitmapUtilsTest.java
index 5bf2819..1ce010f 100644
--- a/services/shape_detection/android/junit/src/org/chromium/shape_detection/BitmapUtilsTest.java
+++ b/services/shape_detection/android/junit/src/org/chromium/shape_detection/BitmapUtilsTest.java
@@ -6,6 +6,8 @@
import static org.junit.Assert.assertNull;
+import android.os.Build;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -23,7 +25,7 @@
* Test suite for conversion-to-Frame utils.
*/
@RunWith(BaseRobolectricTestRunner.class)
-@Config(sdk = 21, manifest = Config.NONE)
+@Config(sdk = Build.VERSION_CODES.M, manifest = Config.NONE)
public class BitmapUtilsTest {
private static final int VALID_WIDTH = 1;
private static final int VALID_HEIGHT = 1;
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
index 1b4b9ff..d0d1a3f 100644
--- a/third_party/android_deps/BUILD.gn
+++ b/third_party/android_deps/BUILD.gn
@@ -74,6 +74,7 @@
"//third_party/robolectric:android-all-4.4_r1-robolectric-r2_java",
"//third_party/robolectric:android-all-5.0.2_r3-robolectric-r0_java",
+ "//third_party/robolectric:android-all-6.0.1_r3-robolectric-r1_java",
"//third_party/robolectric:android-all-7.1.0_r7-robolectric-r1_java",
"//third_party/robolectric:android-all-8.0.0_r4-robolectric-r1_java",
"//third_party/robolectric:android-all-8.1.0-robolectric-4611349_java",
diff --git a/third_party/robolectric/BUILD.gn b/third_party/robolectric/BUILD.gn
index 1876fa5..f69349e9 100644
--- a/third_party/robolectric/BUILD.gn
+++ b/third_party/robolectric/BUILD.gn
@@ -16,6 +16,12 @@
jar_path = "lib/android-all-5.0.2_r3-robolectric-r0.jar"
}
+java_prebuilt("android-all-6.0.1_r3-robolectric-r1_java") {
+ enable_bytecode_checks = false
+ testonly = true
+ jar_path = "lib/android-all-6.0.1_r3-robolectric-r1.jar"
+}
+
java_prebuilt("android-all-7.1.0_r7-robolectric-r1_java") {
enable_bytecode_checks = false
testonly = true