blob: efbcf4768053ba7b65b6fcd4af9ebc686b312e66 [file] [log] [blame]
Yu Shan726d51a2022-02-22 17:37:21 -08001/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "VtsHalAutomotiveVehicle"
18
19#include <IVhalClient.h>
20#include <VehicleHalTypes.h>
21#include <VehicleUtils.h>
22#include <aidl/Gtest.h>
23#include <aidl/Vintf.h>
24#include <aidl/android/hardware/automotive/vehicle/IVehicle.h>
25#include <android-base/stringprintf.h>
26#include <android-base/thread_annotations.h>
27#include <android/binder_process.h>
28#include <gtest/gtest.h>
29#include <hidl/GtestPrinter.h>
30#include <hidl/ServiceManagement.h>
31#include <inttypes.h>
32#include <utils/Log.h>
Yu Shan4569ef52022-03-18 14:34:25 -070033#include <utils/SystemClock.h>
Yu Shan726d51a2022-02-22 17:37:21 -080034
35#include <chrono>
36#include <mutex>
37#include <unordered_map>
38#include <unordered_set>
39#include <vector>
40
41using ::aidl::android::hardware::automotive::vehicle::IVehicle;
42using ::aidl::android::hardware::automotive::vehicle::StatusCode;
43using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions;
44using ::aidl::android::hardware::automotive::vehicle::VehicleArea;
45using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
46using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
Aaqib Ismail20486702022-10-27 16:58:50 -070047using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
48using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup;
Yu Shan726d51a2022-02-22 17:37:21 -080049using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
50using ::android::getAidlHalInstanceNames;
51using ::android::base::ScopedLockAssertion;
52using ::android::base::StringPrintf;
Chen Chengfaf9adc2022-06-22 23:09:09 +000053using ::android::frameworks::automotive::vhal::ErrorCode;
Yu Shan726d51a2022-02-22 17:37:21 -080054using ::android::frameworks::automotive::vhal::HalPropError;
55using ::android::frameworks::automotive::vhal::IHalPropConfig;
56using ::android::frameworks::automotive::vhal::IHalPropValue;
57using ::android::frameworks::automotive::vhal::ISubscriptionCallback;
58using ::android::frameworks::automotive::vhal::IVhalClient;
59using ::android::hardware::getAllHalInstanceNames;
60using ::android::hardware::Sanitize;
61using ::android::hardware::automotive::vehicle::toInt;
62
63constexpr int32_t kInvalidProp = 0x31600207;
64
65struct ServiceDescriptor {
66 std::string name;
67 bool isAidlService;
68};
69
70class VtsVehicleCallback final : public ISubscriptionCallback {
71 private:
72 std::mutex mLock;
73 std::unordered_map<int32_t, size_t> mEventsCount GUARDED_BY(mLock);
Yu Shan4569ef52022-03-18 14:34:25 -070074 std::unordered_map<int32_t, std::vector<int64_t>> mEventTimestamps GUARDED_BY(mLock);
Yu Shan726d51a2022-02-22 17:37:21 -080075 std::condition_variable mEventCond;
76
77 public:
78 void onPropertyEvent(const std::vector<std::unique_ptr<IHalPropValue>>& values) override {
79 {
80 std::lock_guard<std::mutex> lockGuard(mLock);
81 for (auto& value : values) {
Yu Shan4569ef52022-03-18 14:34:25 -070082 int32_t propId = value->getPropId();
83 mEventsCount[propId] += 1;
84 mEventTimestamps[propId].push_back(value->getTimestamp());
Yu Shan726d51a2022-02-22 17:37:21 -080085 }
86 }
87 mEventCond.notify_one();
88 }
89
90 void onPropertySetError([[maybe_unused]] const std::vector<HalPropError>& errors) override {
91 // Do nothing.
92 }
93
94 template <class Rep, class Period>
95 bool waitForExpectedEvents(int32_t propId, size_t expectedEvents,
96 const std::chrono::duration<Rep, Period>& timeout) {
97 std::unique_lock<std::mutex> uniqueLock(mLock);
98 return mEventCond.wait_for(uniqueLock, timeout, [this, propId, expectedEvents] {
99 ScopedLockAssertion lockAssertion(mLock);
100 return mEventsCount[propId] >= expectedEvents;
101 });
102 }
103
Yu Shan4569ef52022-03-18 14:34:25 -0700104 std::vector<int64_t> getEventTimestamps(int32_t propId) {
105 {
106 std::lock_guard<std::mutex> lockGuard(mLock);
107 return mEventTimestamps[propId];
108 }
109 }
110
Yu Shan726d51a2022-02-22 17:37:21 -0800111 void reset() {
112 std::lock_guard<std::mutex> lockGuard(mLock);
113 mEventsCount.clear();
114 }
115};
116
117class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam<ServiceDescriptor> {
118 public:
Aaqib Ismail20486702022-10-27 16:58:50 -0700119 void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access,
120 VehiclePropertyChangeMode changeMode, VehiclePropertyGroup group,
121 VehicleArea area, VehiclePropertyType propertyType);
Yu Shan726d51a2022-02-22 17:37:21 -0800122 virtual void SetUp() override {
123 auto descriptor = GetParam();
124 if (descriptor.isAidlService) {
125 mVhalClient = IVhalClient::tryCreateAidlClient(descriptor.name.c_str());
126 } else {
127 mVhalClient = IVhalClient::tryCreateHidlClient(descriptor.name.c_str());
128 }
129
130 ASSERT_NE(mVhalClient, nullptr) << "Failed to connect to VHAL";
131
132 mCallback = std::make_shared<VtsVehicleCallback>();
133 }
134
135 static bool isBooleanGlobalProp(int32_t property) {
136 return (property & toInt(VehiclePropertyType::MASK)) ==
137 toInt(VehiclePropertyType::BOOLEAN) &&
138 (property & toInt(VehicleArea::MASK)) == toInt(VehicleArea::GLOBAL);
139 }
140
141 protected:
142 std::shared_ptr<IVhalClient> mVhalClient;
143 std::shared_ptr<VtsVehicleCallback> mCallback;
144};
145
146TEST_P(VtsHalAutomotiveVehicleTargetTest, useAidlBackend) {
147 if (!mVhalClient->isAidlVhal()) {
148 GTEST_SKIP() << "AIDL backend is not available, HIDL backend is used instead";
149 }
150}
151
152TEST_P(VtsHalAutomotiveVehicleTargetTest, useHidlBackend) {
153 if (mVhalClient->isAidlVhal()) {
154 GTEST_SKIP() << "AIDL backend is available, HIDL backend is not used";
155 }
156}
157
158// Test getAllPropConfig() returns at least 4 property configs.
159TEST_P(VtsHalAutomotiveVehicleTargetTest, getAllPropConfigs) {
160 ALOGD("VtsHalAutomotiveVehicleTargetTest::getAllPropConfigs");
161
162 auto result = mVhalClient->getAllPropConfigs();
163
164 ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: "
165 << result.error().message();
166 ASSERT_GE(result.value().size(), 4u) << StringPrintf(
167 "Expect to get at least 4 property configs, got %zu", result.value().size());
168}
169
170// Test getPropConfigs() can query all properties listed in CDD.
171TEST_P(VtsHalAutomotiveVehicleTargetTest, getRequiredPropConfigs) {
172 ALOGD("VtsHalAutomotiveVehicleTargetTest::getRequiredPropConfigs");
173
174 // Check the properties listed in CDD
175 std::vector<int32_t> properties = {
176 toInt(VehicleProperty::GEAR_SELECTION), toInt(VehicleProperty::NIGHT_MODE),
177 toInt(VehicleProperty::PARKING_BRAKE_ON), toInt(VehicleProperty::PERF_VEHICLE_SPEED)};
178
179 auto result = mVhalClient->getPropConfigs(properties);
180
181 ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
182 << result.error().message();
183 ASSERT_EQ(result.value().size(), 4u)
184 << StringPrintf("Expect to get exactly 4 configs, got %zu", result.value().size());
185}
186
187// Test getPropConfig() with an invalid propertyId returns an error code.
188TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithInvalidProp) {
189 ALOGD("VtsHalAutomotiveVehicleTargetTest::getPropConfigsWithInvalidProp");
190
191 auto result = mVhalClient->getPropConfigs({kInvalidProp});
192
193 ASSERT_FALSE(result.ok()) << StringPrintf(
194 "Expect failure to get prop configs for invalid prop: %" PRId32, kInvalidProp);
195 ASSERT_NE(result.error().message(), "") << "Expect error message not to be empty";
196}
197
198// Test get() return current value for properties.
199TEST_P(VtsHalAutomotiveVehicleTargetTest, get) {
200 ALOGD("VtsHalAutomotiveVehicleTargetTest::get");
201
202 int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
203 auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
204
205 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
206 ", error: %s",
207 propId, result.error().message().c_str());
208 ASSERT_NE(result.value(), nullptr) << "Result value must not be null";
209}
210
211// Test get() with an invalid propertyId return an error codes.
212TEST_P(VtsHalAutomotiveVehicleTargetTest, getInvalidProp) {
213 ALOGD("VtsHalAutomotiveVehicleTargetTest::getInvalidProp");
214
215 auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(kInvalidProp));
216
217 ASSERT_FALSE(result.ok()) << StringPrintf(
218 "Expect failure to get property for invalid prop: %" PRId32, kInvalidProp);
219}
220
221// Test set() on read_write properties.
222TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) {
223 ALOGD("VtsHalAutomotiveVehicleTargetTest::setProp");
224
225 // skip hvac related properties
226 std::unordered_set<int32_t> hvacProps = {toInt(VehicleProperty::HVAC_DEFROSTER),
227 toInt(VehicleProperty::HVAC_AC_ON),
228 toInt(VehicleProperty::HVAC_MAX_AC_ON),
229 toInt(VehicleProperty::HVAC_MAX_DEFROST_ON),
230 toInt(VehicleProperty::HVAC_RECIRC_ON),
231 toInt(VehicleProperty::HVAC_DUAL_ON),
232 toInt(VehicleProperty::HVAC_AUTO_ON),
233 toInt(VehicleProperty::HVAC_POWER_ON),
234 toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON),
235 toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON)};
236 auto result = mVhalClient->getAllPropConfigs();
237 ASSERT_TRUE(result.ok());
238
239 for (const auto& cfgPtr : result.value()) {
240 const IHalPropConfig& cfg = *cfgPtr;
241 int32_t propId = cfg.getPropId();
242 // test on boolean and writable property
243 if (cfg.getAccess() == toInt(VehiclePropertyAccess::READ_WRITE) &&
244 isBooleanGlobalProp(propId) && !hvacProps.count(propId)) {
245 auto propToGet = mVhalClient->createHalPropValue(propId);
246 auto getValueResult = mVhalClient->getValueSync(*propToGet);
247
248 ASSERT_TRUE(getValueResult.ok())
249 << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s",
250 propId, getValueResult.error().message().c_str());
251 ASSERT_NE(getValueResult.value(), nullptr)
252 << StringPrintf("Result value must not be null for property: %" PRId32, propId);
253
254 const IHalPropValue& value = *getValueResult.value();
255 size_t intValueSize = value.getInt32Values().size();
256 ASSERT_EQ(intValueSize, 1u) << StringPrintf(
257 "Expect exactly 1 int value for boolean property: %" PRId32 ", got %zu", propId,
258 intValueSize);
259
260 int setValue = value.getInt32Values()[0] == 1 ? 0 : 1;
261 auto propToSet = mVhalClient->createHalPropValue(propId);
262 propToSet->setInt32Values({setValue});
263 auto setValueResult = mVhalClient->setValueSync(*propToSet);
264
265 ASSERT_TRUE(setValueResult.ok())
266 << StringPrintf("Failed to set value for property: %" PRId32 ", error: %s",
267 propId, setValueResult.error().message().c_str());
268
269 // check set success
270 getValueResult = mVhalClient->getValueSync(*propToGet);
271 ASSERT_TRUE(getValueResult.ok())
272 << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s",
273 propId, getValueResult.error().message().c_str());
274 ASSERT_NE(getValueResult.value(), nullptr)
275 << StringPrintf("Result value must not be null for property: %" PRId32, propId);
276 ASSERT_EQ(getValueResult.value()->getInt32Values(), std::vector<int32_t>({setValue}))
277 << StringPrintf("Boolean value not updated after set for property: %" PRId32,
278 propId);
279 }
280 }
281}
282
283// Test set() on an read_only property.
284TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) {
285 ALOGD("VtsHalAutomotiveVehicleTargetTest::setNotWritableProp");
286
287 int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
288 auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
289 ASSERT_TRUE(getValueResult.ok())
290 << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", propId,
291 getValueResult.error().message().c_str());
292
293 auto setValueResult = mVhalClient->setValueSync(*getValueResult.value());
294
295 ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail";
Chen Chengfaf9adc2022-06-22 23:09:09 +0000296 ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL);
Yu Shan726d51a2022-02-22 17:37:21 -0800297}
298
299// Test subscribe() and unsubscribe().
300TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) {
301 ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe");
302
303 int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
304
Yu Shan4569ef52022-03-18 14:34:25 -0700305 auto propConfigsResult = mVhalClient->getPropConfigs({propId});
306
307 ASSERT_TRUE(propConfigsResult.ok()) << "Failed to get property config for PERF_VEHICLE_SPEED: "
308 << "error: " << propConfigsResult.error().message();
309 ASSERT_EQ(propConfigsResult.value().size(), 1u)
310 << "Expect to return 1 config for PERF_VEHICLE_SPEED";
311 auto& propConfig = propConfigsResult.value()[0];
312 float minSampleRate = propConfig->getMinSampleRate();
313 float maxSampleRate = propConfig->getMaxSampleRate();
314
315 if (minSampleRate < 1) {
316 GTEST_SKIP() << "Sample rate for vehicle speed < 1 times/sec, skip test since it would "
317 "take too long";
318 }
Yu Shan726d51a2022-02-22 17:37:21 -0800319
320 auto client = mVhalClient->getSubscriptionClient(mCallback);
321 ASSERT_NE(client, nullptr) << "Failed to get subscription client";
322
Yu Shan4569ef52022-03-18 14:34:25 -0700323 auto result = client->subscribe({{.propId = propId, .sampleRate = minSampleRate}});
Yu Shan726d51a2022-02-22 17:37:21 -0800324
325 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32
326 ", error: %s",
327 propId, result.error().message().c_str());
Yu Shan4569ef52022-03-18 14:34:25 -0700328
329 if (mVhalClient->isAidlVhal()) {
330 // Skip checking timestamp for HIDL because the behavior for sample rate and timestamp is
331 // only specified clearly for AIDL.
332
333 // Timeout is 2 seconds, which gives a 1 second buffer.
334 ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(minSampleRate),
335 std::chrono::seconds(2)))
336 << "Didn't get enough events for subscribing to minSampleRate";
337 }
338
339 result = client->subscribe({{.propId = propId, .sampleRate = maxSampleRate}});
340
341 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32
342 ", error: %s",
343 propId, result.error().message().c_str());
344
345 if (mVhalClient->isAidlVhal()) {
346 ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(maxSampleRate),
347 std::chrono::seconds(2)))
348 << "Didn't get enough events for subscribing to maxSampleRate";
349
350 std::unordered_set<int64_t> timestamps;
351 // Event event should have a different timestamp.
352 for (const int64_t& eventTimestamp : mCallback->getEventTimestamps(propId)) {
353 ASSERT_TRUE(timestamps.find(eventTimestamp) == timestamps.end())
354 << "two events for the same property must not have the same timestamp";
355 timestamps.insert(eventTimestamp);
356 }
357 }
Yu Shan726d51a2022-02-22 17:37:21 -0800358
359 result = client->unsubscribe({propId});
360 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to unsubscribe to property: %" PRId32
361 ", error: %s",
362 propId, result.error().message().c_str());
363
364 mCallback->reset();
365 ASSERT_FALSE(mCallback->waitForExpectedEvents(propId, 10, std::chrono::seconds(1)))
366 << "Expect not to get events after unsubscription";
367}
368
369// Test subscribe() with an invalid property.
370TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeInvalidProp) {
371 ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeInvalidProp");
372
373 std::vector<SubscribeOptions> options = {
374 SubscribeOptions{.propId = kInvalidProp, .sampleRate = 10.0}};
375
376 auto client = mVhalClient->getSubscriptionClient(mCallback);
377 ASSERT_NE(client, nullptr) << "Failed to get subscription client";
378
379 auto result = client->subscribe(options);
380
381 ASSERT_FALSE(result.ok()) << StringPrintf("Expect subscribing to property: %" PRId32 " to fail",
382 kInvalidProp);
383}
384
Yu Shan4569ef52022-03-18 14:34:25 -0700385// Test the timestamp returned in GetValues results is the timestamp when the value is retrieved.
386TEST_P(VtsHalAutomotiveVehicleTargetTest, testGetValuesTimestampAIDL) {
387 if (!mVhalClient->isAidlVhal()) {
388 GTEST_SKIP() << "Skip checking timestamp for HIDL because the behavior is only specified "
389 "for AIDL";
390 }
391
392 int32_t propId = toInt(VehicleProperty::PARKING_BRAKE_ON);
393 auto prop = mVhalClient->createHalPropValue(propId);
394
395 auto result = mVhalClient->getValueSync(*prop);
396
397 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
398 ", error: %s",
399 propId, result.error().message().c_str());
400 ASSERT_NE(result.value(), nullptr) << "Result value must not be null";
401 ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value";
402
403 bool parkBrakeOnValue1 = (result.value()->getInt32Values()[0] == 1);
404 int64_t timestampValue1 = result.value()->getTimestamp();
405
406 result = mVhalClient->getValueSync(*prop);
407
408 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
409 ", error: %s",
410 propId, result.error().message().c_str());
411 ASSERT_NE(result.value(), nullptr) << "Result value must not be null";
412 ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value";
413
414 bool parkBarkeOnValue2 = (result.value()->getInt32Values()[0] == 1);
415 int64_t timestampValue2 = result.value()->getTimestamp();
416
417 if (parkBarkeOnValue2 == parkBrakeOnValue1) {
418 ASSERT_EQ(timestampValue2, timestampValue1)
419 << "getValue result must contain a timestamp updated when the value was updated, if"
420 "the value does not change, expect the same timestamp";
421 } else {
422 ASSERT_GT(timestampValue2, timestampValue1)
423 << "getValue result must contain a timestamp updated when the value was updated, if"
424 "the value changes, expect the newer value has a larger timestamp";
425 }
426}
427
Aaqib Ismail20486702022-10-27 16:58:50 -0700428// Helper function to compare actual vs expected property config
429void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId,
430 VehiclePropertyAccess access,
431 VehiclePropertyChangeMode changeMode,
432 VehiclePropertyGroup group, VehicleArea area,
433 VehiclePropertyType propertyType) {
434 int expectedPropId = toInt(propId);
435 int expectedAccess = toInt(access);
436 int expectedChangeMode = toInt(changeMode);
437 int expectedGroup = toInt(group);
438 int expectedArea = toInt(area);
439 int expectedPropertyType = toInt(propertyType);
440
Eva Chen17bc5782023-01-06 22:59:58 -0800441 auto result = mVhalClient->getAllPropConfigs();
442 ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: "
443 << result.error().message();
444
445 // Check if property is implemented by getting all configs and looking to see if the expected
446 // property id is in that list.
447 bool isExpectedPropIdImplemented = false;
448 for (const auto& cfgPtr : result.value()) {
449 const IHalPropConfig& cfg = *cfgPtr;
450 if (expectedPropId == cfg.getPropId()) {
451 isExpectedPropIdImplemented = true;
452 break;
453 }
454 }
455
456 if (!isExpectedPropIdImplemented) {
457 GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented",
458 expectedPropId);
459 }
460
461 result = mVhalClient->getPropConfigs({expectedPropId});
Aaqib Ismail20486702022-10-27 16:58:50 -0700462 ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
463 << result.error().message();
464
Aaqib Ismail20486702022-10-27 16:58:50 -0700465 ASSERT_EQ(result.value().size(), 1u)
466 << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size());
467
468 const auto& config = result.value().at(0);
469 int actualPropId = config->getPropId();
470 int actualAccess = config->getAccess();
471 int actualChangeMode = config->getChangeMode();
472 int actualGroup = actualPropId & toInt(VehiclePropertyGroup::MASK);
473 int actualArea = actualPropId & toInt(VehicleArea::MASK);
474 int actualPropertyType = actualPropId & toInt(VehiclePropertyType::MASK);
475
476 ASSERT_EQ(actualPropId, expectedPropId)
477 << StringPrintf("Expect to get property ID: %i, got %i", expectedPropId, actualPropId);
478
479 if (expectedAccess == toInt(VehiclePropertyAccess::READ_WRITE)) {
480 ASSERT_TRUE(actualAccess == expectedAccess ||
481 actualAccess == toInt(VehiclePropertyAccess::READ))
482 << StringPrintf("Expect to get VehiclePropertyAccess: %i or %i, got %i",
483 expectedAccess, toInt(VehiclePropertyAccess::READ), actualAccess);
484 } else {
485 ASSERT_EQ(actualAccess, expectedAccess) << StringPrintf(
486 "Expect to get VehiclePropertyAccess: %i, got %i", expectedAccess, actualAccess);
487 }
488
489 ASSERT_EQ(actualChangeMode, expectedChangeMode)
490 << StringPrintf("Expect to get VehiclePropertyChangeMode: %i, got %i",
491 expectedChangeMode, actualChangeMode);
492 ASSERT_EQ(actualGroup, expectedGroup) << StringPrintf(
493 "Expect to get VehiclePropertyGroup: %i, got %i", expectedGroup, actualGroup);
494 ASSERT_EQ(actualArea, expectedArea)
495 << StringPrintf("Expect to get VehicleArea: %i, got %i", expectedArea, actualArea);
496 ASSERT_EQ(actualPropertyType, expectedPropertyType)
497 << StringPrintf("Expect to get VehiclePropertyType: %i, got %i", expectedPropertyType,
498 actualPropertyType);
499}
500
shrikar668df362022-12-20 22:08:17 +0000501TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) {
502 verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED,
503 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
504 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
505}
506
shrikar80cc0c52023-01-30 16:56:53 +0000507TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistStateConfig) {
508 verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ,
509 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
510 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
511}
512
shrikar5d1b8162023-01-25 19:31:23 +0000513TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) {
514 verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE,
515 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
516 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
shrikar808a2942022-12-21 17:07:32 +0000517}
518
shrikard440ed42023-01-31 00:25:14 +0000519TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) {
520 verifyProperty(VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE,
521 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
522 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
523}
524
shrikar2753b9e2023-01-31 00:25:14 +0000525TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) {
526 verifyProperty(VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ,
527 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
528 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
529}
530
shrikar5df0f952023-02-02 00:15:39 +0000531TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) {
532 verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE,
533 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
534 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
535}
536
shrikar37833e12022-12-15 20:13:14 +0000537TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) {
538 verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE,
539 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
540 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
541}
542
shrikar2c7aaa62022-12-15 21:05:34 +0000543TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) {
544 verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED,
545 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
546 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
547}
548
Aaqib Ismailc69e9682022-11-22 12:50:00 -0800549TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) {
550 verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL,
551 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
552 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
553}
554
shrikar2dae80f2022-12-21 23:50:17 +0000555TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvStoppingModeConfig) {
556 verifyProperty(VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE,
557 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
558 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
559}
560
Aaqib Ismailaec678a2022-12-07 16:22:42 -0800561TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) {
562 verifyProperty(VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ,
563 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
564 VehicleArea::GLOBAL, VehiclePropertyType::FLOAT);
565}
566
shrikar83914472022-12-16 20:28:47 +0000567TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEngineIdleAutoStopEnabledConfig) {
568 verifyProperty(VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED,
569 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
570 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
571}
572
Aaqib Ismail20486702022-10-27 16:58:50 -0700573TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) {
574 verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE,
575 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
576 VehicleArea::DOOR, VehiclePropertyType::BOOLEAN);
577}
578
Aaqib Ismail63d52d12023-01-30 12:35:10 -0800579TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersPeriodConfig) {
580 verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ,
581 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
582 VehicleArea::WINDOW, VehiclePropertyType::INT32);
583}
584
Aaqib Ismail732a1d72023-01-31 10:25:45 -0800585TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersStateConfig) {
586 verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ,
587 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
588 VehicleArea::WINDOW, VehiclePropertyType::INT32);
589}
590
Aaqib Ismail7f941b42022-11-04 14:55:13 -0700591TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) {
592 verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE,
593 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
594 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
595}
596
Aaqib Ismail34fe92f2022-11-04 21:41:23 -0700597TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthMoveConfig) {
598 verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE,
599 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
600 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
601}
602
Aaqib Ismail53b81c92022-11-07 17:47:04 -0800603TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightPosConfig) {
604 verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE,
605 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
606 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
607}
608
Aaqib Ismail6c4bf192022-11-08 15:00:32 -0800609TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightMoveConfig) {
610 verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE,
611 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
612 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
613}
614
Aaqib Ismail8d051182022-11-09 13:28:48 -0800615TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelTheftLockEnabledConfig) {
616 verifyProperty(VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED,
617 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
618 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
619}
620
Aaqib Ismail68d3f122022-11-09 14:43:32 -0800621TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) {
622 verifyProperty(VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE,
623 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
624 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
625}
626
Aaqib Ismaild4d6adf2022-11-09 16:59:47 -0800627TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelEasyAccessEnabledConfig) {
628 verifyProperty(VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED,
629 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
630 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
631}
632
Aaqib Ismail0dc7ba02022-11-10 14:28:09 -0800633TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsStateConfig) {
634 verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ,
635 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
636 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
637}
638
Aaqib Ismail4b8688f2022-11-15 15:13:35 -0800639TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsSwitchConfig) {
640 verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE,
641 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
642 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
643}
644
Arati Gerdesd86c7fd2022-12-19 12:32:29 -0800645TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxDoorPosConfig) {
646 verifyProperty(VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE,
647 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
648 VehicleArea::SEAT, VehiclePropertyType::INT32);
649}
650
Aaqib Ismail57be4032023-02-02 14:15:03 -0800651TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxLockedConfig) {
652 verifyProperty(VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE,
653 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
654 VehicleArea::SEAT, VehiclePropertyType::BOOLEAN);
655}
656
shrikara1367212022-11-02 16:07:35 +0000657TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) {
658 verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE,
659 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
660 VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN);
661}
662
663TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) {
664 verifyProperty(VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE,
665 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
666 VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN);
667}
668
Aaqib Ismail4e6144c2022-12-15 15:32:18 -0800669TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatHeadrestHeightPosV2Config) {
670 verifyProperty(VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE,
671 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
672 VehicleArea::SEAT, VehiclePropertyType::INT32);
673}
674
shrikar6ae79162022-12-16 03:03:25 +0000675TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) {
676 verifyProperty(VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE,
677 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
678 VehicleArea::SEAT, VehiclePropertyType::INT32);
679}
680
shrikarfb65ae52022-11-03 23:12:51 +0000681TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsStateConfig) {
682 verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ,
683 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
684 VehicleArea::SEAT, VehiclePropertyType::INT32);
685}
686
shrikar93cf1be2022-11-30 15:00:52 -0800687TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsSwitchConfig) {
688 verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE,
689 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
690 VehicleArea::SEAT, VehiclePropertyType::INT32);
691}
692
shrikar3326de02022-11-07 23:51:20 +0000693TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) {
694 verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE,
695 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
696 VehicleArea::SEAT, VehiclePropertyType::BOOLEAN);
697}
698
shrikarb96e3762022-11-08 16:49:58 -0800699TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagEnabledConfig) {
700 verifyProperty(VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE,
701 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
702 VehicleArea::SEAT, VehiclePropertyType::BOOLEAN);
703}
704
shrikar802ecb52022-11-09 18:27:06 +0000705TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) {
706 verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS,
707 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
708 VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32);
709}
710
shrikar1f0ce0d2022-11-11 17:46:06 +0000711TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportMoveConfig) {
712 verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE,
713 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
714 VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32);
715}
716
shrikareff71b22022-11-11 11:02:43 -0800717TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalPosConfig) {
718 verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE,
719 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
720 VehicleArea::SEAT, VehiclePropertyType::INT32);
721}
722
shrikar2a081c52022-11-11 16:49:58 -0800723TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalMoveConfig) {
724 verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE,
725 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
726 VehicleArea::SEAT, VehiclePropertyType::INT32);
727}
728
Aaqib Ismail5d53aa32022-12-13 22:30:23 +0000729TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabledConfig) {
730 verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED,
731 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
732 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
733}
734
Aaqib Ismail28ee23c2023-01-04 23:04:46 -0800735TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingStateConfig) {
736 verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ,
737 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
738 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
739}
740
Aaqib Ismaila2513672022-12-15 00:55:27 +0000741TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledConfig) {
742 verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED,
743 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
744 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
745}
746
Aaqib Ismail0a1ab292023-01-19 21:33:56 +0000747TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) {
748 verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ,
749 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
750 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
751}
752
Aaqib Ismail3f7177a2022-12-17 09:20:00 -0800753TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) {
754 verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE,
755 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
756 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
757}
758
Aaqib Ismail5fc97bb2023-01-10 17:07:47 -0800759TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningStateConfig) {
760 verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ,
761 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
762 VehicleArea::MIRROR, VehiclePropertyType::INT32);
763}
764
Aaqib Ismail7a46cef2022-12-17 10:00:59 -0800765TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfig) {
766 verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED,
767 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
768 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
769}
770
Aaqib Ismail8462db52023-01-27 19:59:49 -0800771TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningStateConfig) {
772 verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ,
773 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
774 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
775}
776
Aaqib Ismail20cc66a2022-12-22 05:38:28 -0800777TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) {
778 verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE,
779 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
780 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
781}
782
Aaqib Ismail78db2ca2023-01-10 17:34:28 -0800783TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistStateConfig) {
784 verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ,
785 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
786 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
787}
788
Aaqib Ismailb1680a72022-12-14 23:28:49 +0000789TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) {
790 verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED,
791 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
792 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
793}
794
Aaqib Ismail0ffd39c2023-01-11 12:19:10 -0800795TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistCommandConfig) {
796 verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE,
797 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
798 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
799}
800
Aaqib Ismaildb034442023-01-10 18:14:28 -0800801TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) {
802 verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ,
803 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
804 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
805}
806
Yu Shan726d51a2022-02-22 17:37:21 -0800807std::vector<ServiceDescriptor> getDescriptors() {
808 std::vector<ServiceDescriptor> descriptors;
809 for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) {
810 descriptors.push_back({
811 .name = name,
812 .isAidlService = true,
813 });
814 }
815 for (std::string name : getAllHalInstanceNames(IVehicle::descriptor)) {
816 descriptors.push_back({
817 .name = name,
818 .isAidlService = false,
819 });
820 }
821 return descriptors;
822}
823
824GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalAutomotiveVehicleTargetTest);
825
826INSTANTIATE_TEST_SUITE_P(PerInstance, VtsHalAutomotiveVehicleTargetTest,
827 testing::ValuesIn(getDescriptors()),
828 [](const testing::TestParamInfo<ServiceDescriptor>& info) {
829 std::string name = "";
830 if (info.param.isAidlService) {
831 name += "aidl_";
832 } else {
833 name += "hidl_";
834 }
835 name += info.param.name;
836 return Sanitize(name);
837 });
838
839int main(int argc, char** argv) {
840 ::testing::InitGoogleTest(&argc, argv);
841 ABinderProcess_setThreadPoolMaxThreadCount(1);
842 return RUN_ALL_TESTS();
843}