Merge "VTS: fix RadioHidlTest.getAvailableNetworks issue" am: 89b2d24fb0

am: 0c9df89f88

Change-Id: I5c59f4e1964bdbd387031a13290b52352af4e172
This commit is contained in:
Iris Chang 2017-11-15 04:12:24 +00:00 committed by android-build-merger
commit 2d47467288
5 changed files with 9 additions and 9 deletions

View file

@ -142,7 +142,7 @@ TEST_F(RadioHidlTest, getAvailableNetworks) {
int serial = GetRandomSerialNumber();
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);
ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);

View file

@ -51,13 +51,13 @@ void RadioHidlTest::notify() {
cv.notify_one();
}
std::cv_status RadioHidlTest::wait() {
std::cv_status RadioHidlTest::wait(int sec) {
std::unique_lock<std::mutex> lock(mtx);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
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) {
return status;
}

View file

@ -527,7 +527,7 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
void notify();
/* 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 */
bool CheckGeneralError();
@ -538,4 +538,4 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
sp<IRadio> radio;
sp<RadioResponse> radioRsp;
sp<RadioIndication> radioInd;
};
};

View file

@ -52,13 +52,13 @@ void RadioHidlTest_v1_1::notify() {
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::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
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) {
return status;
}

View file

@ -550,7 +550,7 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase {
void notify();
/* 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 */
bool CheckGeneralError();
@ -561,4 +561,4 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase {
sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1;
sp<RadioResponse_v1_1> radioRsp_v1_1;
sp<RadioIndication_v1_1> radioInd_v1_1;
};
};