Merge "Add a new vts directory under 1.1 for radio 1.1 APIs vts tests." into oc-dr1-dev
am: 00eb34b57a
Change-Id: I491d9ce3eb219ae2bd8b9988b0ca5d20b1d80144
This commit is contained in:
commit
79762563bc
21 changed files with 292 additions and 15 deletions
|
@ -70,3 +70,38 @@ cc_test {
|
|||
"-g",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "RadioHidlHalUtilsBase",
|
||||
srcs : [
|
||||
"radio_hidl_hal_test.cpp",
|
||||
"radio_response.cpp"
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libcutils",
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libnativehelper",
|
||||
"libutils",
|
||||
"android.hardware.radio@1.0",
|
||||
],
|
||||
static_libs: ["VtsHalHidlTargetTestBase"],
|
||||
cflags: [
|
||||
"-O0",
|
||||
"-g",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "RadioVtsTestUtilBase",
|
||||
srcs : [
|
||||
"vts_test_util.cpp"
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_headers {
|
||||
name: "radio.util.header@1.0",
|
||||
export_include_dirs: ["."],
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
using namespace ::android::hardware::radio::V1_0;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
using namespace ::android::hardware::radio::V1_0;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
/*
|
||||
* Test IRadio.getIccCardStatus() for the response returned.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
using namespace ::android::hardware::radio::V1_0;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
/*
|
||||
* Test IRadio.getSignalStrength() for the response returned.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
using namespace ::android::hardware::radio::V1_0;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
using namespace ::android::hardware::radio::V1_0;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
void RadioHidlTest::SetUp() {
|
||||
radio =
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <android/hardware/radio/1.0/IRadioResponse.h>
|
||||
#include <android/hardware/radio/1.0/types.h>
|
||||
|
||||
#include <vts_test_util.h>
|
||||
#include "vts_test_util.h"
|
||||
|
||||
using ::android::hardware::radio::V1_0::ActivityStatsInfo;
|
||||
using ::android::hardware::radio::V1_0::AppType;
|
||||
|
@ -90,7 +90,7 @@ extern CardStatus cardStatus;
|
|||
|
||||
/* Callback class for radio response */
|
||||
class RadioResponse : public IRadioResponse {
|
||||
private:
|
||||
protected:
|
||||
RadioHidlTest& parent;
|
||||
|
||||
public:
|
||||
|
@ -442,7 +442,7 @@ class RadioResponse : public IRadioResponse {
|
|||
|
||||
// The main test class for Radio HIDL.
|
||||
class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
private:
|
||||
protected:
|
||||
std::mutex mtx;
|
||||
std::condition_variable cv;
|
||||
int count;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
/*
|
||||
* Test IRadio.getCurrentCalls() for the response returned.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils.h>
|
||||
#include <radio_hidl_hal_utils_v1_0.h>
|
||||
|
||||
CardStatus cardStatus;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <android/hardware/radio/1.0/ISapCallback.h>
|
||||
#include <android/hardware/radio/1.0/types.h>
|
||||
|
||||
#include <vts_test_util.h>
|
||||
#include "vts_test_util.h"
|
||||
|
||||
using namespace ::android::hardware::radio::V1_0;
|
||||
|
||||
|
|
45
radio/1.1/vts/functional/Android.bp
Normal file
45
radio/1.1/vts/functional/Android.bp
Normal file
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalRadioV1_1TargetTest",
|
||||
defaults: ["hidl_defaults"],
|
||||
srcs: ["radio_hidl_hal_api.cpp",
|
||||
"radio_hidl_hal_test.cpp",
|
||||
"radio_response.cpp",
|
||||
"VtsHalRadioV1_1TargetTest.cpp"],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libcutils",
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libnativehelper",
|
||||
"libutils",
|
||||
"android.hardware.radio@1.1",
|
||||
"android.hardware.radio@1.0",
|
||||
],
|
||||
static_libs: ["VtsHalHidlTargetTestBase",
|
||||
"RadioHidlHalUtilsBase",
|
||||
"RadioVtsTestUtilBase"],
|
||||
header_libs: [
|
||||
"radio.util.header@1.0",
|
||||
],
|
||||
cflags: [
|
||||
"-O0",
|
||||
"-g",
|
||||
],
|
||||
}
|
27
radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
Normal file
27
radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils_v1_1.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
|
||||
return status;
|
||||
}
|
36
radio/1.1/vts/functional/radio_hidl_hal_api.cpp
Normal file
36
radio/1.1/vts/functional/radio_hidl_hal_api.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils_v1_1.h>
|
||||
|
||||
/*
|
||||
* Test IRadio.setSimCardPower() for the response returned.
|
||||
*/
|
||||
TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) {
|
||||
int serial = GetRandomSerialNumber();
|
||||
|
||||
radio_v1_1->setSimCardPower_1_1(serial, CardPowerState::POWER_DOWN);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
|
||||
|
||||
if (cardStatus.cardState == CardState::ABSENT) {
|
||||
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
|
||||
radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
|
||||
radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
|
||||
radioRsp_v1_1->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
|
||||
}
|
||||
}
|
39
radio/1.1/vts/functional/radio_hidl_hal_test.cpp
Normal file
39
radio/1.1/vts/functional/radio_hidl_hal_test.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils_v1_1.h>
|
||||
|
||||
void RadioHidlTest_v1_1::SetUp() {
|
||||
radio_v1_1 =
|
||||
::testing::VtsHalHidlTargetTestBase::getService<::android::hardware::radio::V1_1::IRadio>(
|
||||
hidl_string(RADIO_SERVICE_NAME));
|
||||
ASSERT_NE(radio_v1_1, nullptr);
|
||||
|
||||
radioRsp_v1_1 = new RadioResponse_v1_1(*this);
|
||||
ASSERT_NE(radioRsp_v1_1, nullptr);
|
||||
|
||||
count = 0;
|
||||
|
||||
radioInd_v1_1 = NULL;
|
||||
radio_v1_1->setResponseFunctions(radioRsp_v1_1, radioInd_v1_1);
|
||||
|
||||
int serial = GetRandomSerialNumber();
|
||||
radio_v1_1->getIccCardStatus(serial);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
|
||||
EXPECT_EQ(RadioError::NONE, radioRsp_v1_1->rspInfo.error);
|
||||
}
|
54
radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
Normal file
54
radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android/hardware/radio/1.1/IRadio.h>
|
||||
#include <android/hardware/radio/1.1/IRadioIndication.h>
|
||||
#include <android/hardware/radio/1.1/IRadioResponse.h>
|
||||
#include <android/hardware/radio/1.1/types.h>
|
||||
|
||||
#include "radio_hidl_hal_utils_v1_0.h"
|
||||
|
||||
using namespace ::android::hardware::radio::V1_1;
|
||||
|
||||
class RadioHidlTest_v1_1;
|
||||
|
||||
/* Callback class for radio response v1_1*/
|
||||
class RadioResponse_v1_1 : public RadioResponse {
|
||||
protected:
|
||||
RadioHidlTest_v1_1& parent_v1_1;
|
||||
|
||||
public:
|
||||
RadioResponse_v1_1(RadioHidlTest_v1_1& parent_v1_1);
|
||||
virtual ~RadioResponse_v1_1() = default;
|
||||
|
||||
/* 1.1 Api */
|
||||
Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info);
|
||||
|
||||
Return<void> setSimCardPowerResponse_1_1(const RadioResponseInfo& info);
|
||||
|
||||
Return<void> startNetworkScanResponse(const RadioResponseInfo& info);
|
||||
|
||||
Return<void> stopNetworkScanResponse(const RadioResponseInfo& info);
|
||||
};
|
||||
|
||||
// The main test class for Radio HIDL.
|
||||
class RadioHidlTest_v1_1 : public RadioHidlTest {
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1;
|
||||
sp<RadioResponse_v1_1> radioRsp_v1_1;
|
||||
sp<::android::hardware::radio::V1_1::IRadioIndication> radioInd_v1_1;
|
||||
};
|
40
radio/1.1/vts/functional/radio_response.cpp
Normal file
40
radio/1.1/vts/functional/radio_response.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <radio_hidl_hal_utils_v1_1.h>
|
||||
|
||||
RadioResponse_v1_1::RadioResponse_v1_1(RadioHidlTest_v1_1& parent)
|
||||
: RadioResponse(parent), parent_v1_1(parent) {}
|
||||
|
||||
/* 1.1 Apis */
|
||||
Return<void> RadioResponse_v1_1::setCarrierInfoForImsiEncryptionResponse(
|
||||
const RadioResponseInfo& /*info*/) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> RadioResponse_v1_1::setSimCardPowerResponse_1_1(const RadioResponseInfo& info) {
|
||||
rspInfo = info;
|
||||
parent_v1_1.notify();
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> RadioResponse_v1_1::startNetworkScanResponse(const RadioResponseInfo& /*info*/) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo& /*info*/) {
|
||||
return Void();
|
||||
}
|
|
@ -3,5 +3,6 @@ subdirs = [
|
|||
"1.0",
|
||||
"1.0/vts/functional",
|
||||
"1.1",
|
||||
"1.1/vts/functional",
|
||||
"deprecated/1.0",
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue