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

Commit 8431b21a authored by Rambo Wang's avatar Rambo Wang Committed by Android (Google) Code Review
Browse files

Merge "Add VTS test case to cover multiple RANs per request" into tm-dev

parents 9c15ed74 926d66ed
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
@@ -591,6 +591,89 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSSINR) {
                                 {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}

/*
 * Test IRadioNetwork.setSignalStrengthReportingCriteria() for multi-RANs per request
 */
TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_multiRansPerRequest) {
    SignalThresholdInfo signalThresholdInfoGeran;
    signalThresholdInfoGeran.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI;
    signalThresholdInfoGeran.hysteresisMs = 5000;
    signalThresholdInfoGeran.hysteresisDb = 2;
    signalThresholdInfoGeran.thresholds = {-109, -103, -97, -89};
    signalThresholdInfoGeran.isEnabled = true;
    signalThresholdInfoGeran.ran = AccessNetwork::GERAN;

    SignalThresholdInfo signalThresholdInfoUtran;
    signalThresholdInfoUtran.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSCP;
    signalThresholdInfoUtran.hysteresisMs = 5000;
    signalThresholdInfoUtran.hysteresisDb = 2;
    signalThresholdInfoUtran.thresholds = {-110, -97, -73, -49, -25};
    signalThresholdInfoUtran.isEnabled = true;
    signalThresholdInfoUtran.ran = AccessNetwork::UTRAN;

    SignalThresholdInfo signalThresholdInfoEutran;
    signalThresholdInfoEutran.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSRP;
    signalThresholdInfoEutran.hysteresisMs = 5000;
    signalThresholdInfoEutran.hysteresisDb = 2;
    signalThresholdInfoEutran.thresholds = {-128, -108, -88, -68};
    signalThresholdInfoEutran.isEnabled = true;
    signalThresholdInfoEutran.ran = AccessNetwork::EUTRAN;

    SignalThresholdInfo signalThresholdInfoCdma2000;
    signalThresholdInfoCdma2000.signalMeasurement =
            SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI;
    signalThresholdInfoCdma2000.hysteresisMs = 5000;
    signalThresholdInfoCdma2000.hysteresisDb = 2;
    signalThresholdInfoCdma2000.thresholds = {-105, -90, -75, -65};
    signalThresholdInfoCdma2000.isEnabled = true;
    signalThresholdInfoCdma2000.ran = AccessNetwork::CDMA2000;

    SignalThresholdInfo signalThresholdInfoNgran;
    signalThresholdInfoNgran.signalMeasurement =
            SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_SSRSRP;
    signalThresholdInfoNgran.hysteresisMs = 5000;
    signalThresholdInfoNgran.hysteresisDb = 0;
    signalThresholdInfoNgran.thresholds = {-105, -90, -75, -65};
    signalThresholdInfoNgran.isEnabled = true;
    signalThresholdInfoNgran.ran = AccessNetwork::NGRAN;

    const static std::vector<SignalThresholdInfo> candidateSignalThresholdInfos = {
            signalThresholdInfoGeran, signalThresholdInfoUtran, signalThresholdInfoEutran,
            signalThresholdInfoCdma2000, signalThresholdInfoNgran};

    std::vector<SignalThresholdInfo> supportedSignalThresholdInfos;
    for (size_t i = 0; i < candidateSignalThresholdInfos.size(); i++) {
        serial = GetRandomSerialNumber();
        ndk::ScopedAStatus res = radio_network->setSignalStrengthReportingCriteria(
                serial, {candidateSignalThresholdInfos[i]});
        ASSERT_OK(res);
        EXPECT_EQ(std::cv_status::no_timeout, wait());
        if (radioRsp_network->rspInfo.error == RadioError::NONE) {
            supportedSignalThresholdInfos.push_back(signalThresholdInfoGeran);
        } else {
            // Refer to IRadioNetworkResponse#setSignalStrengthReportingCriteriaResponse
            ASSERT_TRUE(CheckAnyOfErrors(
                    radioRsp_network->rspInfo.error,
                    {RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE}));
        }
    }

    ASSERT_FALSE(supportedSignalThresholdInfos.empty());

    serial = GetRandomSerialNumber();
    ndk::ScopedAStatus res = radio_network->setSignalStrengthReportingCriteria(
            serial, supportedSignalThresholdInfos);
    ASSERT_OK(res);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);

    ALOGI("setSignalStrengthReportingCriteria_multiRansPerRequest, rspInfo.error = %s\n",
          toString(radioRsp_network->rspInfo.error).c_str());

    ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
}

/*
 * Test IRadioNetwork.setLinkCapacityReportingCriteria() invalid hysteresisDlKbps
 */