33f958e6852d2837b14a8ecbbd0881b29f57bc5d
[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_callback_onerror</title>
27 <script src="support/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
29 </head>
30 <body>
31 <div id="log"></div>
32 <script>
33 //==== TEST: BluetoothHealthApplication_unregister_callback_onerror
34 //==== LABEL Check if error callback of unregister method invoked
35 //==== PRIORITY P1
36 //==== ONLOAD_DELAY 180
37 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothHealthApplication:unregister M
38 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
39 //==== TEST_CRITERIA MERRCB
40
41 setup({timeout: 180000});
42 var adapter, healthProfileHandler, powerOnSuccess, healthRegisterSuccess, healthRegisterError,
43     t = async_test(document.title, {timeout: 180000}),
44     appName = "testSinkApp", errorCallback, successCallback, registerHealthAppCp, powerOffSuccess,
45     successCallback;
46
47 t.step(function () {
48     adapter = tizen.bluetooth.getDefaultAdapter();
49
50     errorCallback = t.step_func(function (error) {
51         assert_equals(error.name, "ServiceNotAvailableError", "expected another error");
52
53         t.done();
54     });
55
56     successCallback = t.step_func(function () {
57         assert_unreached("invalid successCallback invoked");
58     });
59
60     powerOffSuccess = t.step_func(function () {
61         registerHealthAppCp.unregister(successCallback, errorCallback);
62     });
63
64     healthRegisterSuccess = t.step_func(function (registerHealthApp) {
65         registerHealthAppCp = registerHealthApp;
66         setUnpowered(t, adapter, powerOffSuccess);
67     });
68
69     healthRegisterError = t.step_func(function (e) {
70         assert_unreached("healthRegisterError exception:" + e.message);
71     });
72
73     powerOnSuccess = t.step_func(function () {
74         healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
75         healthProfileHandler.registerSinkApplication(REMOTE_HEALTH_DEVICE_TYPE, appName, healthRegisterSuccess, healthRegisterError);
76     });
77
78     setPowered(t, adapter, powerOnSuccess);
79 });
80
81 </script>
82 </body>
83 </html>