Loosen speed check for first GPS location

As it is often found in a short integration
window with very high Doppler uncertainty.

Bug: 67877519
Test: Verified Pixel still passes VTS
Change-Id: Ia05359f572f4ea7be81f9d5fe30bd619322bebd3
This commit is contained in:
Wyatt Riley
2017-10-26 16:37:30 -07:00
parent b620501f0e
commit adca98d590

View File

@@ -147,7 +147,8 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
EXPECT_EQ(location_called_count_, 1);
}
if (location_called_count_ > 0) {
CheckLocation(last_location_, checkAccuracies);
// don't require speed on first fix
CheckLocation(last_location_, checkAccuracies, false);
return true;
}
return false;
@@ -176,20 +177,24 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
/*
* CheckLocation:
* Helper function to vet Location fields
* Helper function to vet Location fields
*/
void CheckLocation(GnssLocation& location, bool checkAccuracies) {
void CheckLocation(GnssLocation& location, bool checkAccuracies, bool checkSpeed) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
if (checkSpeed) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
}
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
// New uncertainties available in O must be provided,
// at least when paired with modern hardware (2017+)
if (checkAccuracies) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY);
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY);
if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY);
if (checkSpeed) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY);
if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY);
}
}
}
EXPECT_GE(location.latitudeDegrees, -90.0);
@@ -198,12 +203,14 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
EXPECT_LE(location.longitudeDegrees, 180.0);
EXPECT_GE(location.altitudeMeters, -1000.0);
EXPECT_LE(location.altitudeMeters, 30000.0);
EXPECT_GE(location.speedMetersPerSec, 0.0);
EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary.
if (checkSpeed) {
EXPECT_GE(location.speedMetersPerSec, 0.0);
EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary.
// Non-zero speeds must be reported with an associated bearing
if (location.speedMetersPerSec > 0.0) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
// Non-zero speeds must be reported with an associated bearing
if (location.speedMetersPerSec > 0.0) {
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
}
}
/*
@@ -356,7 +363,7 @@ TEST_F(GnssHalTest, GetLocation) {
for (int i = 1; i < LOCATIONS_TO_CHECK; i++) {
EXPECT_EQ(std::cv_status::no_timeout, wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
EXPECT_EQ(location_called_count_, i + 1);
CheckLocation(last_location_, checkMoreAccuracies);
CheckLocation(last_location_, checkMoreAccuracies, true);
}
}