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

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

Merge "Fix setAllowedCarrier"

parents c417c549 b2f6aa1e
Loading
Loading
Loading
Loading
+30 −20
Original line number Diff line number Diff line
@@ -778,20 +778,27 @@ TEST_F(RadioHidlTest, setAllowedCarriers) {
                                     {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
    }

    if (radioRsp->rspInfo.error == RadioError::NONE) {
        /* Setting to carrier restriction needs some time */
        updateSimCardStatus();
        auto startTime = std::chrono::system_clock::now();
        while (cardStatus.cardState != CardState::RESTRICTED &&
           std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime)
               std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
                                                           startTime)
                       .count() < 10) {
            /* Set 2 seconds as interval to check card status */
            sleep(2);
            updateSimCardStatus();
        }
        EXPECT_EQ(CardState::RESTRICTED, cardStatus.cardState);
    }
    sleep(10);

    /* Reset back to no carrier restriction */
    /** 
     * Another test case of the API to cover to allow carrier.
     * If the API is supported, this is also used to reset to no carrier restriction
     * status for cardStatus. 
     */
    memset(&carriers, 0, sizeof(carriers));
    carriers.allowedCarriers.resize(0);
    carriers.excludedCarriers.resize(0);
@@ -807,11 +814,13 @@ TEST_F(RadioHidlTest, setAllowedCarriers) {
                                     {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
    }

    if (radioRsp->rspInfo.error == RadioError::NONE) {
        /* Resetting back to no carrier restriction needs some time */
        updateSimCardStatus();
    startTime = std::chrono::system_clock::now();
        auto startTime = std::chrono::system_clock::now();
        while (cardStatus.cardState == CardState::RESTRICTED &&
           std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime)
               std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
                                                           startTime)
                       .count() < 10) {
            /* Set 2 seconds as interval to check card status */
            sleep(2);
@@ -820,6 +829,7 @@ TEST_F(RadioHidlTest, setAllowedCarriers) {
        EXPECT_NE(CardState::RESTRICTED, cardStatus.cardState);
        sleep(10);
    }
}

/*
 * Test IRadio.getAllowedCarriers() for the response returned.