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

Commit 0c9df89f authored by Iris Chang's avatar Iris Chang Committed by android-build-merger
Browse files

Merge "VTS: fix RadioHidlTest.getAvailableNetworks issue"

am: 89b2d24f

Change-Id: I96c5b3873c53fba6fca5905f0a5897a7f8801f4a
parents c8c5001b 89b2d24f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -142,7 +142,7 @@ TEST_F(RadioHidlTest, getAvailableNetworks) {
    int serial = GetRandomSerialNumber();
    int serial = GetRandomSerialNumber();


    radio->getAvailableNetworks(serial);
    radio->getAvailableNetworks(serial);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(std::cv_status::no_timeout, wait(300));
    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
    ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
    ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
                radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
                radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
+2 −2
Original line number Original line Diff line number Diff line
@@ -51,13 +51,13 @@ void RadioHidlTest::notify() {
    cv.notify_one();
    cv.notify_one();
}
}


std::cv_status RadioHidlTest::wait() {
std::cv_status RadioHidlTest::wait(int sec) {
    std::unique_lock<std::mutex> lock(mtx);
    std::unique_lock<std::mutex> lock(mtx);


    std::cv_status status = std::cv_status::no_timeout;
    std::cv_status status = std::cv_status::no_timeout;
    auto now = std::chrono::system_clock::now();
    auto now = std::chrono::system_clock::now();
    while (count == 0) {
    while (count == 0) {
        status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
        status = cv.wait_until(lock, now + std::chrono::seconds(sec));
        if (status == std::cv_status::timeout) {
        if (status == std::cv_status::timeout) {
            return status;
            return status;
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -527,7 +527,7 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
    void notify();
    void notify();


    /* Test code calls this function to wait for response */
    /* Test code calls this function to wait for response */
    std::cv_status wait();
    std::cv_status wait(int sec = TIMEOUT_PERIOD);


    /* Used for checking General Errors */
    /* Used for checking General Errors */
    bool CheckGeneralError();
    bool CheckGeneralError();
+2 −2
Original line number Original line Diff line number Diff line
@@ -52,13 +52,13 @@ void RadioHidlTest_v1_1::notify() {
    cv.notify_one();
    cv.notify_one();
}
}


std::cv_status RadioHidlTest_v1_1::wait() {
std::cv_status RadioHidlTest_v1_1::wait(int sec) {
    std::unique_lock<std::mutex> lock(mtx);
    std::unique_lock<std::mutex> lock(mtx);


    std::cv_status status = std::cv_status::no_timeout;
    std::cv_status status = std::cv_status::no_timeout;
    auto now = std::chrono::system_clock::now();
    auto now = std::chrono::system_clock::now();
    while (count == 0) {
    while (count == 0) {
        status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
        status = cv.wait_until(lock, now + std::chrono::seconds(sec));
        if (status == std::cv_status::timeout) {
        if (status == std::cv_status::timeout) {
            return status;
            return status;
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -550,7 +550,7 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase {
    void notify();
    void notify();


    /* Test code calls this function to wait for response */
    /* Test code calls this function to wait for response */
    std::cv_status wait();
    std::cv_status wait(int sec = TIMEOUT_PERIOD);


    /* Used for checking General Errors */
    /* Used for checking General Errors */
    bool CheckGeneralError();
    bool CheckGeneralError();