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 Lukasz Bardeli <l.bardeli@samsung.com>
26 <title>BluetoothServiceHandler_unregister_errorCallback_invalid_cb</title>
27 <script src="../resources/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
34 //==== TEST: BluetoothServiceHandler_unregister_errorCallback_invalid_cb
35 //==== LABEL check unregister argument errorCallback validation
37 //==== ONLOAD_DELAY 90
38 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
39 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
40 //==== TEST_CRITERIA MTCB
41 setup({timeout: 90000, explicit_done:true});
43 var t = async_test("BluetoothServiceHandler_unregister_errorCallback_invalid_cb", {timeout: 90000});
45 var adapter, exceptionName = "TypeMismatchError", incorrectCallback, unregisterSuccess,
46 registerSuccessCB, registerErrorCB, powerOnSuccess, powerOnError;
49 onerror: t.step_func(function (error) {
50 assert_unreached("Invalid errorCallback invoked: " + error.name + ": " + error.message);
54 unregisterSuccess = t.step_func(function (e) {
55 assert_unreached("unregisterSuccess exception:" + e.message);
58 registerSuccessCB = t.step_func(function (handler) {
59 setBluetoothHandlerCleanup(handler);
60 assert_throws({name : exceptionName},
62 handler.unregister(unregisterSuccess, incorrectCallback);
63 },exceptionName + " should be thrown - given incorrect error callback.");
68 registerErrorCB = t.step_func(function (e) {
69 assert_unreached("registerErrorCB exception:" + e.message);
72 powerOnSuccess = t.step_func(function () {
73 adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", registerSuccessCB, registerErrorCB);
76 powerOnError = t.step_func(function (e) {
77 assert_unreached("powerOnError exception:" + e.message);
80 adapter = tizen.bluetooth.getDefaultAdapter();
81 adapter.setPowered(true, powerOnSuccess, powerOnError);