3 Copyright (c) 2015 Samsung Electronics Co., Ltd.
5 Licensed under the Apache License, Version 2.0 (the License);
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
18 Xiaoyan Qian <xy.qian@samsung.com>
23 <title>BluetoothGATTDescriptor_readValue_successCallback_invalid_cb</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
26 <script src="support/bluetooth_common.js"></script>
31 //==== TEST: BluetoothGATTDescriptor_readValue_successCallback_invalid_cb
32 //==== LABEL Check if readValue throws exception when successrCallback is invalid
33 //==== EXECUTION_TYPE manual
34 //==== ONLOAD_DELAY 30
35 //==== SPEC Tizen Web API:TBD:Bluetooth:BluetoothGATTDescriptor:readValue M
38 //==== PRE The bluetooth of the remote/test device MUST support BLE and be turned on and discoverable from other devices.
39 //==== TEST_CRITERIA MTCB
41 setup({timeout: 60000});
43 var t = async_test(document.title, {timeout: 60000}), adapter, BbLEScanSuccessCallback, BbLEScanErrorCallback, service,
44 onconnected, onerror, characteristic, descriptor, incorrectCallback, device = null, flag = false, i;
48 onread: t.step_func(function (value) {
49 assert_unreached("Invalid successcallback invoked");
53 onconnected = t.step_func(function () {
54 service = device.getService(device.uuids[0]);
55 for (i = 0; i < service.characteristics.length; i++) {
56 characteristic = service.characteristics[i];
57 if (characteristic != undefined) {
58 descriptor = characteristic.descriptors[0];
59 if (descriptor != undefined) {
60 assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
61 descriptor.readValue(incorrectCallback);
62 }, "Given incorrect successCallback.");
70 onerror = t.step_func(function (error) {
71 assert_unreached("connect() error callback was invoked: " + error.name + " msg: " + error.message);
74 BbLEScanSuccessCallback = t.step_func(function (bledevice) {
75 if (bledevice.address == REMOTE_BLE_DEVICE_ADDRESS && device == null) {
79 device.connect(onconnected, onerror);
85 BbLEScanErrorCallback = t.step_func(function (error) {
86 assert_unreached("startScan() error callback was invoked: " + error.name + " msg: " + error.message);
89 adapter = tizen.bluetooth.getLEAdapter();
91 adapter.startScan(BbLEScanSuccessCallback, BbLEScanErrorCallback);