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_TypeMismatch</title>
27 <script src="../resources/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
34 //==== TEST: BluetoothServiceHandler_unregister_errorCallback_TypeMismatch
35 //==== LABEL Check argument unregister errorCallback conversions exception
37 //==== STEP Check argument unregister errorCallback conversions exception.
38 //==== EXPECT argument unregister errorCallback conversions exception checked.
39 //==== ONLOAD_DELAY 90
40 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
41 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
42 //==== TEST_CRITERIA MC
43 setup({timeout: 90000});
45 var adapter = null, t = async_test("BluetoothServiceHandler_unregister_errorCallback_TypeMismatch", {timeout: 90000}),
46 exceptionName, errorCallback, i,
47 conversionTable, successCallback, registerSuccessCB, registerErrorCB, powerOnSuccess, powerOnError;
49 conversionTable = getTypeConversionExceptions("functionObject", true);
51 successCallback = t.step_func(function () {
52 assert_unreached("successCallback shouldn't be here");
55 registerSuccessCB = t.step_func(function (handler) {
56 for(i = 0; i < conversionTable.length; i++) {
57 errorCallback = conversionTable[i][0];
58 exceptionName = conversionTable[i][1];
60 assert_throws({name : exceptionName},
62 handler.unregister(successCallback, errorCallback);
63 }, exceptionName + " should be thrown - given incorrect errorCallback.");
69 registerErrorCB = t.step_func(function (e) {
70 assert_unreached("registerErrorCB exception:" + e.message);
73 powerOnSuccess = t.step_func(function () {
74 adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", registerSuccessCB, registerErrorCB);
77 powerOnError = t.step_func(function (e) {
78 assert_unreached("powerOnError exception:" + e.message);
81 adapter = tizen.bluetooth.getDefaultAdapter();
82 adapter.setPowered(true, powerOnSuccess, powerOnError);