Loading gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +35 −31 Original line number Diff line number Diff line Loading @@ -134,13 +134,30 @@ class GnssHalTest : public testing::TestWithParam<std::string> { return status; } /* * SetPositionMode: * Helper function to set positioning mode and verify output */ void SetPositionMode(const int min_interval_msec) { const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider) const int kPreferredTimeMsec = 0; // Ideally immediate auto result = gnss_hal_->setPositionMode( IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC, min_interval_msec, kPreferredAccuracy, kPreferredTimeMsec); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); } /* * StartAndGetSingleLocation: * Helper function to get one Location and check fields * * returns true if a location was successfully generated */ bool StartAndGetSingleLocation(bool checkAccuracies) { bool StartAndGetSingleLocation(const bool checkAccuracies, const int min_interval_msec) { SetPositionMode(min_interval_msec); auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); Loading Loading @@ -349,33 +366,20 @@ TEST_P(GnssHalTest, SetCallbackCapabilitiesCleanup) {} * and checks them for reasonable validity. */ TEST_P(GnssHalTest, GetLocation) { #define MIN_INTERVAL_MSEC 500 #define PREFERRED_ACCURACY 0 // Ideally perfect (matches GnssLocationProvider) #define PREFERRED_TIME_MSEC 0 // Ideally immediate #define LOCATION_TIMEOUT_SUBSEQUENT_SEC 3 #define LOCATIONS_TO_CHECK 5 const int kMinIntervalMsec = 500; const int kLocationTimeoutSubsequentSec = 3; const int kLocationsToCheck = 5; bool checkMoreAccuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017); auto result = gnss_hal_->setPositionMode( IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC, MIN_INTERVAL_MSEC, PREFERRED_ACCURACY, PREFERRED_TIME_MSEC); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); bool checkMoreAccuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017); /* * GPS signals initially optional for this test, so don't expect no timeout * yet * GPS signals initially optional for this test, so don't expect timeout yet. */ bool gotLocation = StartAndGetSingleLocation(checkMoreAccuracies); bool gotLocation = StartAndGetSingleLocation(checkMoreAccuracies, kMinIntervalMsec); if (gotLocation) { for (int i = 1; i < LOCATIONS_TO_CHECK; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC)); for (int i = 1; i < kLocationsToCheck; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec)); EXPECT_EQ(location_called_count_, i + 1); CheckLocation(last_location_, checkMoreAccuracies, true); } Loading Loading @@ -410,7 +414,7 @@ TEST_P(GnssHalTest, InjectDelete) { ASSERT_TRUE(resultVoid.isOk()); // Ensure we can get a good location after a bad injection has been deleted StartAndGetSingleLocation(false); StartAndGetSingleLocation(false, /* min_interval_sec= */ 1000); StopAndClearLocations(); } Loading @@ -430,7 +434,7 @@ TEST_P(GnssHalTest, InjectSeedLocation) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); StartAndGetSingleLocation(false); StartAndGetSingleLocation(false, /* min_interval_msec= */ 1000); // Ensure we don't get a location anywhere within 111km (1 degree of lat or lng) of the seed // location. Loading gnss/1.1/vts/functional/gnss_hal_test.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -99,7 +99,9 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } bool GnssHalTest::StartAndCheckFirstLocation(bool strict) { bool GnssHalTest::StartAndCheckFirstLocation(const bool strict, const int min_interval_msec, const bool low_power_mode) { SetPositionMode(min_interval_msec, low_power_mode); auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); Loading Loading @@ -141,7 +143,9 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true)); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true, /* min_interval_msec= */ 1000, /* low_power_mode= */ false)); for (int i = 1; i < count; i++) { EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, Loading gnss/1.1/vts/functional/gnss_hal_test.h +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ class GnssHalTest : public testing::TestWithParam<std::string> { * * returns true if a location was successfully generated */ bool StartAndCheckFirstLocation(bool strict); bool StartAndCheckFirstLocation(const bool strict, const int min_interval_msec, const bool low_power_mode); /* * CheckLocation: Loading gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -90,10 +90,8 @@ TEST_P(GnssHalTest, GetLocationLowPower) { gnss_cb_->location_cbq_.reset(); // Start of Low Power Mode test SetPositionMode(kMinIntervalMsec, kLowPowerMode); // Don't expect true - as without AGPS access if (!StartAndCheckFirstLocation(/* strict= */ false)) { if (!StartAndCheckFirstLocation(/* strict= */ false, kMinIntervalMsec, kLowPowerMode)) { ALOGW("GetLocationLowPower test - no first low power location received."); } Loading gnss/2.0/vts/functional/gnss_hal_test.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -97,7 +97,9 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } bool GnssHalTest::StartAndCheckFirstLocation(bool strict) { bool GnssHalTest::StartAndCheckFirstLocation(const bool strict, const int min_interval_msec, const bool low_power_mode) { SetPositionMode(min_interval_msec, low_power_mode); const auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); Loading Loading @@ -137,7 +139,9 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true)); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true, /* min_interval_msec= */ 1000, /* low_power_mode= */ false)); for (int i = 1; i < count; i++) { EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, Loading Loading
gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +35 −31 Original line number Diff line number Diff line Loading @@ -134,13 +134,30 @@ class GnssHalTest : public testing::TestWithParam<std::string> { return status; } /* * SetPositionMode: * Helper function to set positioning mode and verify output */ void SetPositionMode(const int min_interval_msec) { const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider) const int kPreferredTimeMsec = 0; // Ideally immediate auto result = gnss_hal_->setPositionMode( IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC, min_interval_msec, kPreferredAccuracy, kPreferredTimeMsec); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); } /* * StartAndGetSingleLocation: * Helper function to get one Location and check fields * * returns true if a location was successfully generated */ bool StartAndGetSingleLocation(bool checkAccuracies) { bool StartAndGetSingleLocation(const bool checkAccuracies, const int min_interval_msec) { SetPositionMode(min_interval_msec); auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); Loading Loading @@ -349,33 +366,20 @@ TEST_P(GnssHalTest, SetCallbackCapabilitiesCleanup) {} * and checks them for reasonable validity. */ TEST_P(GnssHalTest, GetLocation) { #define MIN_INTERVAL_MSEC 500 #define PREFERRED_ACCURACY 0 // Ideally perfect (matches GnssLocationProvider) #define PREFERRED_TIME_MSEC 0 // Ideally immediate #define LOCATION_TIMEOUT_SUBSEQUENT_SEC 3 #define LOCATIONS_TO_CHECK 5 const int kMinIntervalMsec = 500; const int kLocationTimeoutSubsequentSec = 3; const int kLocationsToCheck = 5; bool checkMoreAccuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017); auto result = gnss_hal_->setPositionMode( IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC, MIN_INTERVAL_MSEC, PREFERRED_ACCURACY, PREFERRED_TIME_MSEC); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); bool checkMoreAccuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017); /* * GPS signals initially optional for this test, so don't expect no timeout * yet * GPS signals initially optional for this test, so don't expect timeout yet. */ bool gotLocation = StartAndGetSingleLocation(checkMoreAccuracies); bool gotLocation = StartAndGetSingleLocation(checkMoreAccuracies, kMinIntervalMsec); if (gotLocation) { for (int i = 1; i < LOCATIONS_TO_CHECK; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC)); for (int i = 1; i < kLocationsToCheck; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec)); EXPECT_EQ(location_called_count_, i + 1); CheckLocation(last_location_, checkMoreAccuracies, true); } Loading Loading @@ -410,7 +414,7 @@ TEST_P(GnssHalTest, InjectDelete) { ASSERT_TRUE(resultVoid.isOk()); // Ensure we can get a good location after a bad injection has been deleted StartAndGetSingleLocation(false); StartAndGetSingleLocation(false, /* min_interval_sec= */ 1000); StopAndClearLocations(); } Loading @@ -430,7 +434,7 @@ TEST_P(GnssHalTest, InjectSeedLocation) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); StartAndGetSingleLocation(false); StartAndGetSingleLocation(false, /* min_interval_msec= */ 1000); // Ensure we don't get a location anywhere within 111km (1 degree of lat or lng) of the seed // location. Loading
gnss/1.1/vts/functional/gnss_hal_test.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -99,7 +99,9 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } bool GnssHalTest::StartAndCheckFirstLocation(bool strict) { bool GnssHalTest::StartAndCheckFirstLocation(const bool strict, const int min_interval_msec, const bool low_power_mode) { SetPositionMode(min_interval_msec, low_power_mode); auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); Loading Loading @@ -141,7 +143,9 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true)); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true, /* min_interval_msec= */ 1000, /* low_power_mode= */ false)); for (int i = 1; i < count; i++) { EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, Loading
gnss/1.1/vts/functional/gnss_hal_test.h +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ class GnssHalTest : public testing::TestWithParam<std::string> { * * returns true if a location was successfully generated */ bool StartAndCheckFirstLocation(bool strict); bool StartAndCheckFirstLocation(const bool strict, const int min_interval_msec, const bool low_power_mode); /* * CheckLocation: Loading
gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -90,10 +90,8 @@ TEST_P(GnssHalTest, GetLocationLowPower) { gnss_cb_->location_cbq_.reset(); // Start of Low Power Mode test SetPositionMode(kMinIntervalMsec, kLowPowerMode); // Don't expect true - as without AGPS access if (!StartAndCheckFirstLocation(/* strict= */ false)) { if (!StartAndCheckFirstLocation(/* strict= */ false, kMinIntervalMsec, kLowPowerMode)) { ALOGW("GetLocationLowPower test - no first low power location received."); } Loading
gnss/2.0/vts/functional/gnss_hal_test.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -97,7 +97,9 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } bool GnssHalTest::StartAndCheckFirstLocation(bool strict) { bool GnssHalTest::StartAndCheckFirstLocation(const bool strict, const int min_interval_msec, const bool low_power_mode) { SetPositionMode(min_interval_msec, low_power_mode); const auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); Loading Loading @@ -137,7 +139,9 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true)); EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true, /* min_interval_msec= */ 1000, /* low_power_mode= */ false)); for (int i = 1; i < count; i++) { EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, Loading