7c46b6e6adabbed2c28a6bcd23d7337dda497018
[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         Witold Choinkowski <w.choinkowsk@samsung.com>
22
23 -->
24 <html>
25 <head>
26 <title>BluetoothHealthApplication_unregister_successCallback_TypeMismatch</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: BluetoothHealthApplication_unregister_successCallback_TypeMismatch
35 //==== LABEL Check whether unregister() method called with invalid successCallback throws an exception
36 //==== PRIORITY P2
37 //==== ONLOAD_DELAY 90
38 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothHealthApplication:unregister M
39 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
40 //==== TEST_CRITERIA MC
41
42 setup({timeout:90000, explicit_done:true});
43 var adapter, healthProfileHandler, powerOnSuccess, healthRegisterSuccess, healthRegisterError,
44     t = async_test(document.title, {timeout: 90000}), appName = "testSinkApp",
45     successCallback, exceptionName, i, conversionTable = getTypeConversionExceptions("functionObject", true);
46
47 t.step(function () {
48     adapter = tizen.bluetooth.getDefaultAdapter();
49
50     healthRegisterSuccess = t.step_func(function (registerHealthApp) {
51         setBluetoothHandlerCleanup(registerHealthApp);
52         for(i = 0; i < conversionTable.length; i++) {
53             successCallback = conversionTable[i][0];
54             exceptionName = conversionTable[i][1];
55
56             assert_throws({name: exceptionName},
57                 function () {
58                     registerHealthApp.unregister(successCallback);
59                 }, "Given incorrect successCallback.");
60         }
61
62         t.done();
63     });
64
65     healthRegisterError = t.step_func(function (e) {
66         assert_unreached("healthRegisterError exception:" + e.message);
67     });
68
69     powerOnSuccess = t.step_func(function () {
70         healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
71         healthProfileHandler.registerSinkApplication(REMOTE_HEALTH_DEVICE_TYPE, appName, healthRegisterSuccess, healthRegisterError);
72     });
73
74     setPowered(t, adapter, powerOnSuccess);
75 });
76
77 </script>
78 </body>
79 </html>