Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40b07e71 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Make GetLocationLowPower test warning instead of failing" into android10-tests-dev

parents 8cdbb7c8 dd8769b4
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po
    EXPECT_TRUE(result);
}

bool GnssHalTest::StartAndCheckFirstLocation() {
bool GnssHalTest::StartAndCheckFirstLocation(bool strict) {
    auto result = gnss_hal_->start();

    EXPECT_TRUE(result.isOk());
@@ -119,7 +119,9 @@ bool GnssHalTest::StartAndCheckFirstLocation() {
    const int kFirstGnssLocationTimeoutSeconds = 75;

    wait(kFirstGnssLocationTimeoutSeconds);
    if (strict) {
        EXPECT_EQ(location_called_count_, 1);
    }

    if (location_called_count_ > 0) {
        // don't require speed on first fix
@@ -142,7 +144,7 @@ void GnssHalTest::StartAndCheckLocations(int count) {

    SetPositionMode(kMinIntervalMsec, kLowPowerMode);

    EXPECT_TRUE(StartAndCheckFirstLocation());
    EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true));

    for (int i = 1; i < count; i++) {
        EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec));
+3 −1
Original line number Diff line number Diff line
@@ -113,9 +113,11 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
     *   <p> Note this leaves the Location request active, to enable Stop call vs. other call
     *   reordering tests.
     *
     *   <p> if 'strict' is true, the test will fail if no location is generated.
     *
     * returns  true if a location was successfully generated
     */
    bool StartAndCheckFirstLocation();
    bool StartAndCheckFirstLocation(bool strict);

    /*
     * CheckLocation:
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ TEST_F(GnssHalTest, GetLocationLowPower) {
    SetPositionMode(kMinIntervalMsec, kLowPowerMode);

    // Don't expect true - as without AGPS access
    if (!StartAndCheckFirstLocation()) {
    if (!StartAndCheckFirstLocation(/* strict= */ false)) {
        ALOGW("GetLocationLowPower test - no first low power location received.");
    }

+9 −5
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po
    EXPECT_TRUE(result);
}

bool GnssHalTest::StartAndCheckFirstLocation() {
bool GnssHalTest::StartAndCheckFirstLocation(bool strict) {
    const auto result = gnss_hal_->start();

    EXPECT_TRUE(result.isOk());
@@ -104,12 +104,16 @@ bool GnssHalTest::StartAndCheckFirstLocation() {
     * so allow time to demodulate ephemeris over the air.
     */
    const int kFirstGnssLocationTimeoutSeconds = 75;
    int locationCalledCount = 0;

    if (strict) {
        EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
                                                 kFirstGnssLocationTimeoutSeconds));
    int locationCalledCount = gnss_cb_->location_cbq_.calledCount();
    EXPECT_EQ(locationCalledCount, 1);


        locationCalledCount = gnss_cb_->location_cbq_.calledCount();
        EXPECT_EQ(locationCalledCount, 1);
    }
    if (locationCalledCount > 0) {
        // don't require speed on first fix
        CheckLocation(gnss_cb_->last_location_, false);
@@ -132,7 +136,7 @@ void GnssHalTest::StartAndCheckLocations(int count) {

    SetPositionMode(kMinIntervalMsec, kLowPowerMode);

    EXPECT_TRUE(StartAndCheckFirstLocation());
    EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true));

    for (int i = 1; i < count; i++) {
        EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
+3 −1
Original line number Diff line number Diff line
@@ -214,9 +214,11 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
     *   <p> Note this leaves the Location request active, to enable Stop call vs. other call
     *   reordering tests.
     *
     *   <p> if 'strict' is true, the test will fail if no location is generated.
     *
     * returns  true if a location was successfully generated
     */
    bool StartAndCheckFirstLocation();
    bool StartAndCheckFirstLocation(bool strict);

    /*
     * CheckLocation:
Loading