Home | History | Annotate | Download | only in native
      1 #/usr/bin/env python3.4
      2 #
      3 # Copyright (C) 2016 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
      6 # use this file except in compliance with the License. You may obtain a copy of
      7 # the License at
      8 #
      9 # http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     14 # License for the specific language governing permissions and limitations under
     15 # the License.
     16 
     17 import time
     18 from acts.base_test import BaseTestClass
     19 from acts.test_utils.bt.native_bt_test_utils import setup_native_bluetooth
     20 from acts.test_utils.bt.bt_test_utils import generate_id_by_size
     21 
     22 class NativeTest(BaseTestClass):
     23     tests = None
     24 
     25     def __init__(self, controllers):
     26         BaseTestClass.__init__(self, controllers)
     27         self.droid = self.native_android_devices[0].droid
     28         self.tests = (
     29                 "test_bool_return_true",
     30                 "test_bool_return_false",
     31                 "test_null_return",
     32                 "test_string_empty_return",
     33                 "test_max_param_size",
     34         )
     35 
     36     def test_bool_return_true(self):
     37         return self.droid.TestBoolTrueReturn()
     38 
     39     def test_bool_return_false(self):
     40         return not self.droid.TestBoolFalseReturn()
     41 
     42     def test_null_return(self):
     43         return not self.droid.TestNullReturn()
     44 
     45     def test_string_empty_return(self):
     46         return self.droid.TestStringEmptyReturn() == ""
     47 
     48     def test_max_param_size(self):
     49         json_buffer_size = 64
     50         max_sl4n_buffer_size = 4096
     51         test_string = "x" * (max_sl4n_buffer_size - json_buffer_size)
     52         return test_string == self.droid.TestStringMaxReturn(test_string)
     53 
     54     def test_specific_param_naming(self):
     55         a = [{"string_test":"test", "int_test":1}]
     56         return self.droid.TestSpecificParamNaming(a)
     57 
     58