Check GPS feature in GnssLocationValuesTest.
The test is not applicable to devices not supporting GPS/GNSS.
Bug: 113363547
Test: The tests pass on Chromebook "grunt" (FirstApiLevel=P and No GPS)
Change-Id: Ie96225523e6eb88abfd6db030546bdc755b64059
diff --git a/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java b/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java
index 4d32544..0a341cd 100644
--- a/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java
+++ b/tests/tests/location/src/android/location/cts/GnssLocationValuesTest.java
@@ -67,6 +67,13 @@
* only test them if the hardware is later than 2017
*/
public void testAccuracyFields() throws Exception {
+ // Checks if GPS hardware feature is present, skips test (pass) if not,
+ // and hard asserts that Location/GPS (Provider) is turned on if is Cts Verifier.
+ if (!TestMeasurementUtil.canTestRunOnCurrentDevice(mTestLocationManager,
+ TAG, MIN_HARDWARE_YEAR_MEASUREMENTS_REQUIRED, isCtsVerifierTest())) {
+ return;
+ }
+
SoftAssert softAssert = new SoftAssert(TAG);
mTestLocationManager.requestLocationUpdates(mLocationListener);
boolean success = mLocationListener.await();
@@ -127,6 +134,13 @@
* check whether all fields' value make sense
*/
public void testLocationRegularFields() throws Exception {
+ // Checks if GPS hardware feature is present, skips test (pass) if not,
+ // and hard asserts that Location/GPS (Provider) is turned on if is Cts Verifier.
+ if (!TestMeasurementUtil.canTestRunOnCurrentDevice(mTestLocationManager,
+ TAG, MIN_HARDWARE_YEAR_MEASUREMENTS_REQUIRED, isCtsVerifierTest())) {
+ return;
+ }
+
mTestLocationManager.requestLocationUpdates(mLocationListener);
boolean success = mLocationListener.await();
SoftAssert.failOrWarning(isMeasurementTestStrict(),