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

Commit e4363814 authored by Yu-Han Yang's avatar Yu-Han Yang Committed by Automerger Merge Worker
Browse files

Make GetLocationLowPower test warning instead of failing am: 5f0bbe93

Change-Id: Id7f24611468f776d4e61fff5cc2c3ba91a370f54
parents 8a9bd559 5f0bbe93
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -99,7 +99,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());
@@ -110,11 +110,14 @@ 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();
        locationCalledCount = gnss_cb_->location_cbq_.calledCount();
        EXPECT_EQ(locationCalledCount, 1);
    }

    if (locationCalledCount > 0) {
        // don't require speed on first fix
@@ -138,7 +141,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
@@ -102,9 +102,11 @@ class GnssHalTest : public testing::TestWithParam<std::string> {
     *   <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
@@ -93,7 +93,7 @@ TEST_P(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 −7
Original line number Diff line number Diff line
@@ -97,7 +97,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());
@@ -107,12 +107,14 @@ 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();
        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);
@@ -135,7 +137,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
@@ -152,9 +152,11 @@ class GnssHalTest : public testing::TestWithParam<std::string> {
     *   <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