cb8f590114bda9c0b9d12c2c7df4da8dfca47a1c
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3
4 Copyright (c) 2013 Samsung Electronics Co., Ltd.
5
6 Licensed under the Apache License, Version 2.0 (the License);
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10     http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18
19
20 Authors:
21         Lukasz Bardeli <l.bardeli@samsung.com>
22
23 -->
24 <html>
25 <head>
26 <title>BluetoothAdapter_destroyBonding_errorCallback_invalid_cb</title>
27 <script src="support/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
29 </head>
30 <body>
31
32 <div id="log"></div>
33 <script>
34 //==== TEST: BluetoothAdapter_destroyBonding_errorCallback_invalid_cb
35 //==== LABEL Check if destroyBonding() method throws exception when invalid error callback is given
36 //==== PRIORITY P2
37 //==== EXECUTION_TYPE manual
38 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:destroyBonding M
39 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
40 //==== PRE The bluetooth of the remote device MUST be turned on and discoverable from other devices.
41 //==== TEST_CRITERIA MTCB
42 setup({timeout: 180000});
43 var t = async_test(document.title, {timeout: 180000}),
44     adapter, exceptionName = "TypeMismatchError", incorrectCallback, destroyBondingSuccess,
45     onBondingSuccess, onBondingError, powerOnSuccess;
46 t.step(function () {
47
48     incorrectCallback = {
49         onerror: t.step_func(function (e) {
50             assert_unreached("Invalid errorCallback invoked: " + e.name + ": " + e.message);
51         })
52     };
53
54     destroyBondingSuccess = t.step_func(function (e) {
55         assert_unreached("Method destroyBonding shouldn't end successfully.");
56     });
57
58     onBondingSuccess = t.step_func(function () {
59         assert_throws({name: exceptionName},
60             function () {
61                 adapter.destroyBonding(REMOTE_DEVICE_ADDRESS, destroyBondingSuccess, incorrectCallback);
62             }, "Given incorrect errorCallback.");
63         t.done();
64     });
65
66     onBondingError = t.step_func(function (e) {
67         assert_unreached("onBondingError exception:" + e.message);
68     });
69
70     powerOnSuccess = t.step_func(function () {
71         adapter.createBonding(REMOTE_DEVICE_ADDRESS, onBondingSuccess, onBondingError);
72     });
73
74     adapter = tizen.bluetooth.getDefaultAdapter();
75     setPowered(t, adapter, powerOnSuccess);
76 });
77
78 </script>
79 </body>
80 </html>