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

Commit 2b059b59 authored by Pavel Maltsev's avatar Pavel Maltsev
Browse files

Vehicle HAL: add VTS case for DRIVING_STATUS

Test: ENABLE_TREBLE=true make vts BUILD_GOOGLE_VTS=true -j32 && vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VehicleHidlTest -l INFO
Change-Id: I66a4c7105412da9efd05eb0ef1caed275676488c
parent f24b37b6
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -130,5 +130,39 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
        if isFreezeSupported:
            checkFreezeFrameRead()

    def createVehiclePropValue(self, propId):
        value = {
            "int32Values" : [],
            "floatValues" : [],
            "int64Values" : [],
            "bytes": [],
            "stringValue": ""
        }
        propValue = {
            "prop": propId,
            "timestamp": 0,
            "areaId": 0,
            "value": value
        }
        return self.vtypes.Py2Pb("VehiclePropValue", propValue)

    def testDrivingStatus(self):
        """Checks that DRIVING_STATUS property returns correct result."""
        request = self.createVehiclePropValue(self.vtypes.DRIVING_STATUS)
        logging.info("Driving status request: %s", request)
        response = self.vehicle.get(request)
        logging.info("Driving status response: %s", response)
        status = response[0]
        asserts.assertEqual(self.vtypes.OK, status)
        propValue = response[1]
        assertEqual(1, len(propValue.value.int32Values))
        drivingStatus = propValue.value.int32Values[0]

        allStatuses = self.vtypes.UNRESTRICTED or self.vtypes.NO_VIDEO or
            self.vtypes.NO_KEYBOARD_INPUT or self.vtypes.NO_VOICE_INPUT or
            self.vtypes.NO_CONFIG or self.vtypes.LIMIT_MESSAGE_LEN

        assertEqual(allStatuses, allStatuses or drivingStatus)

if __name__ == "__main__":
    test_runner.main()