4 Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
10 http://www.apache.org/licenses/LICENSE-2.0
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.
21 Witold Choinkowski <w.choinkowsk@samsung.com>
26 <title>BluetoothHealthApplication_unregister_callback_onerror</title>
27 <script src="support/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
33 //==== TEST: BluetoothHealthApplication_unregister_callback_onerror
34 //==== LABEL Check if error callback of unregister method invoked
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
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,
48 adapter = tizen.bluetooth.getDefaultAdapter();
50 errorCallback = t.step_func(function (error) {
51 assert_equals(error.name, "ServiceNotAvailableError", "expected another error");
56 successCallback = t.step_func(function () {
57 assert_unreached("invalid successCallback invoked");
60 powerOffSuccess = t.step_func(function () {
61 registerHealthAppCp.unregister(successCallback, errorCallback);
64 healthRegisterSuccess = t.step_func(function (registerHealthApp) {
65 registerHealthAppCp = registerHealthApp;
66 setUnpowered(t, adapter, powerOffSuccess);
69 healthRegisterError = t.step_func(function (e) {
70 assert_unreached("healthRegisterError exception:" + e.message);
73 powerOnSuccess = t.step_func(function () {
74 healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
75 healthProfileHandler.registerSinkApplication(REMOTE_HEALTH_DEVICE_TYPE, appName, healthRegisterSuccess, healthRegisterError);
78 setPowered(t, adapter, powerOnSuccess);