Loading gnss/1.1/vts/functional/gnss_hal_test.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ void GnssHalTest::StopAndClearLocations() { */ while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) { } location_called_count_ = 0; } void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) { Loading @@ -97,17 +98,17 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } bool GnssHalTest::StartAndGetSingleLocation() { bool GnssHalTest::StartAndCheckFirstLocation() { auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result); /* * GPS signals initially optional for this test, so don't expect fast fix, * or no timeout, unless signal is present * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, * so allow time to demodulate ephemeris over the air. */ const int kFirstGnssLocationTimeoutSeconds = 15; const int kFirstGnssLocationTimeoutSeconds = 75; wait(kFirstGnssLocationTimeoutSeconds); EXPECT_EQ(location_called_count_, 1); Loading Loading @@ -195,7 +196,7 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndGetSingleLocation()); EXPECT_TRUE(StartAndCheckFirstLocation()); for (int i = 1; i < count; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec)); Loading gnss/1.1/vts/functional/gnss_hal_test.h +6 −3 Original line number Diff line number Diff line Loading @@ -107,12 +107,15 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase { void SetUpGnssCallback(); /* * StartAndGetSingleLocation: * Helper function to get one Location and check fields * StartAndCheckFirstLocation: * Helper function to start location, and check the first one. * * <p> Note this leaves the Location request active, to enable Stop call vs. other call * reordering tests. * * returns true if a location was successfully generated */ bool StartAndGetSingleLocation(); bool StartAndCheckFirstLocation(); /* * CheckLocation: Loading gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +30 −9 Original line number Diff line number Diff line Loading @@ -60,24 +60,46 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) { */ TEST_F(GnssHalTest, GetLocationLowPower) { const int kMinIntervalMsec = 5000; const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) + 1; const int kNoLocationPeriodSec = 2; const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; const int kLocationsToCheck = 5; const bool kLowPowerMode = true; // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider StartAndCheckLocations(5); StopAndClearLocations(); // Start of Low Power Mode test SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndGetSingleLocation()); // Don't expect true - as without AGPS access if (!StartAndCheckFirstLocation()) { ALOGW("GetLocationLowPower test - no first low power location received."); } for (int i = 1; i < kLocationsToCheck; i++) { // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and // ensure that no location is received yet wait(kNoLocationPeriodSec); EXPECT_EQ(location_called_count_, i); EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)); EXPECT_EQ(location_called_count_, i + 1); // Tolerate (ignore) one extra location right after the first one // to handle startup edge case scheduling limitations in some implementations if ((i == 1) && (location_called_count_ == 2)) { CheckLocation(last_location_, true); continue; // restart the quiet wait period after this too-fast location } EXPECT_LE(location_called_count_, i); if (location_called_count_ != i) { ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ", location_called_count_, i); } if (std::cv_status::no_timeout != wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) { ALOGW("GetLocationLowPower test - timeout awaiting location %d", i); } else { CheckLocation(last_location_, true); } } StopAndClearLocations(); Loading Loading @@ -236,7 +258,6 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); location_called_count_ = 0; StopAndClearLocations(); list_gnss_sv_status_.clear(); Loading Loading
gnss/1.1/vts/functional/gnss_hal_test.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ void GnssHalTest::StopAndClearLocations() { */ while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) { } location_called_count_ = 0; } void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) { Loading @@ -97,17 +98,17 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } bool GnssHalTest::StartAndGetSingleLocation() { bool GnssHalTest::StartAndCheckFirstLocation() { auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result); /* * GPS signals initially optional for this test, so don't expect fast fix, * or no timeout, unless signal is present * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, * so allow time to demodulate ephemeris over the air. */ const int kFirstGnssLocationTimeoutSeconds = 15; const int kFirstGnssLocationTimeoutSeconds = 75; wait(kFirstGnssLocationTimeoutSeconds); EXPECT_EQ(location_called_count_, 1); Loading Loading @@ -195,7 +196,7 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndGetSingleLocation()); EXPECT_TRUE(StartAndCheckFirstLocation()); for (int i = 1; i < count; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec)); Loading
gnss/1.1/vts/functional/gnss_hal_test.h +6 −3 Original line number Diff line number Diff line Loading @@ -107,12 +107,15 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase { void SetUpGnssCallback(); /* * StartAndGetSingleLocation: * Helper function to get one Location and check fields * StartAndCheckFirstLocation: * Helper function to start location, and check the first one. * * <p> Note this leaves the Location request active, to enable Stop call vs. other call * reordering tests. * * returns true if a location was successfully generated */ bool StartAndGetSingleLocation(); bool StartAndCheckFirstLocation(); /* * CheckLocation: Loading
gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +30 −9 Original line number Diff line number Diff line Loading @@ -60,24 +60,46 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) { */ TEST_F(GnssHalTest, GetLocationLowPower) { const int kMinIntervalMsec = 5000; const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) + 1; const int kNoLocationPeriodSec = 2; const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; const int kLocationsToCheck = 5; const bool kLowPowerMode = true; // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider StartAndCheckLocations(5); StopAndClearLocations(); // Start of Low Power Mode test SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndGetSingleLocation()); // Don't expect true - as without AGPS access if (!StartAndCheckFirstLocation()) { ALOGW("GetLocationLowPower test - no first low power location received."); } for (int i = 1; i < kLocationsToCheck; i++) { // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and // ensure that no location is received yet wait(kNoLocationPeriodSec); EXPECT_EQ(location_called_count_, i); EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)); EXPECT_EQ(location_called_count_, i + 1); // Tolerate (ignore) one extra location right after the first one // to handle startup edge case scheduling limitations in some implementations if ((i == 1) && (location_called_count_ == 2)) { CheckLocation(last_location_, true); continue; // restart the quiet wait period after this too-fast location } EXPECT_LE(location_called_count_, i); if (location_called_count_ != i) { ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ", location_called_count_, i); } if (std::cv_status::no_timeout != wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) { ALOGW("GetLocationLowPower test - timeout awaiting location %d", i); } else { CheckLocation(last_location_, true); } } StopAndClearLocations(); Loading Loading @@ -236,7 +258,6 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); location_called_count_ = 0; StopAndClearLocations(); list_gnss_sv_status_.clear(); Loading