Use parameterized test to disable test for devices without NFC
Test: atest VtsNfcBehaviorChangesTest Bug: 345575225 (cherry picked from https://android-review.googlesource.com/q/commit:a667849ed08197a0811857939d63cdf923f6818d) Merged-In: I22393acc260d200d2e472d276c64af005a75ab6b Change-Id: I22393acc260d200d2e472d276c64af005a75ab6b
This commit is contained in:
parent
250f176013
commit
9ec2405e1a
1 changed files with 14 additions and 2 deletions
|
@ -16,6 +16,10 @@
|
|||
|
||||
#define LOG_TAG "nfc_behavior_changes_test"
|
||||
|
||||
#include <aidl/Gtest.h>
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/nfc/BnNfc.h>
|
||||
#include <aidl/android/hardware/nfc/INfc.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android/binder_process.h>
|
||||
|
@ -30,6 +34,9 @@
|
|||
#include "nfa_api.h"
|
||||
#include "nfa_ee_api.h"
|
||||
|
||||
using aidl::android::hardware::nfc::INfc;
|
||||
using android::getAidlHalInstanceNames;
|
||||
using android::PrintInstanceNameToString;
|
||||
using android::base::StringPrintf;
|
||||
|
||||
static SyncEvent sNfaEnableEvent; // event for NFA_Enable()
|
||||
|
@ -162,7 +169,7 @@ tNFA_STATUS static nfaObserveModeEnable(bool enable) {
|
|||
return status;
|
||||
}
|
||||
|
||||
class NfcBehaviorChanges : public testing::Test {
|
||||
class NfcBehaviorChanges : public testing::TestWithParam<std::string> {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
tNFA_STATUS status = NFA_STATUS_OK;
|
||||
|
@ -202,7 +209,7 @@ class NfcBehaviorChanges : public testing::Test {
|
|||
*
|
||||
* @VsrTest = GMS-VSR-3.2.8-001
|
||||
*/
|
||||
TEST_F(NfcBehaviorChanges, ObserveModeEnableDisable) {
|
||||
TEST_P(NfcBehaviorChanges, ObserveModeEnableDisable) {
|
||||
tNFA_STATUS status = nfaObserveModeEnable(true);
|
||||
ASSERT_EQ(status, NFA_STATUS_OK);
|
||||
|
||||
|
@ -210,6 +217,11 @@ TEST_F(NfcBehaviorChanges, ObserveModeEnableDisable) {
|
|||
ASSERT_EQ(status, NFA_STATUS_OK);
|
||||
}
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(NfcBehaviorChanges);
|
||||
INSTANTIATE_TEST_SUITE_P(Nfc, NfcBehaviorChanges,
|
||||
testing::ValuesIn(::android::getAidlHalInstanceNames(INfc::descriptor)),
|
||||
::android::PrintInstanceNameToString);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
ABinderProcess_startThreadPool();
|
||||
|
|
Loading…
Reference in a new issue