OSDN Git Service

Vehicle HAL: add VTS case for DRIVING_STATUS
authorPavel Maltsev <pavelm@google.com>
Wed, 18 Jan 2017 00:46:35 +0000 (16:46 -0800)
committerPavel Maltsev <pavelm@google.com>
Wed, 25 Jan 2017 06:32:45 +0000 (22:32 -0800)
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

vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py

index cd52abf..8024be2 100644 (file)
@@ -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()