1#!/usr/bin/env python3
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
17import time
18from acts.base_test import BaseTestClass
19from acts.test_utils.bt.native_bt_test_utils import setup_native_bluetooth
20from acts.test_utils.bt.bt_test_utils import generate_id_by_size
21
22class NativeTest(BaseTestClass):
23    tests = None
24
25    def __init__(self, controllers):
26        BaseTestClass.__init__(self, controllers)
27        self.tests = (
28                "test_bool_return_true",
29                "test_bool_return_false",
30                "test_null_return",
31                "test_string_empty_return",
32                "test_max_param_size",
33        )
34
35    def setup_class(self):
36        super().setup_class()
37        self.droid = self.native_android_devices[0].droid
38
39    def test_bool_return_true(self):
40        return self.droid.TestBoolTrueReturn()
41
42    def test_bool_return_false(self):
43        return not self.droid.TestBoolFalseReturn()
44
45    def test_null_return(self):
46        return not self.droid.TestNullReturn()
47
48    def test_string_empty_return(self):
49        return self.droid.TestStringEmptyReturn() == ""
50
51    def test_max_param_size(self):
52        json_buffer_size = 64
53        max_sl4n_buffer_size = 4096
54        test_string = "x" * (max_sl4n_buffer_size - json_buffer_size)
55        return test_string == self.droid.TestStringMaxReturn(test_string)
56
57    def test_specific_param_naming(self):
58        a = [{"string_test":"test", "int_test":1}]
59        return self.droid.TestSpecificParamNaming(a)
60
61