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>BluetoothAdapter_stopDiscovery_successCallback_TypeMismatch</title>
27 <script src="../resources/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
34 //==== TEST: BluetoothAdapter_stopDiscovery_successCallback_TypeMismatch
35 //==== LABEL Check argument stopDiscovery successCallback conversions exception
37 //==== STEP Check argument stopDiscovery successCallback conversions exception.
38 //==== EXPECT argument stopDiscovery successCallback conversions exception checked.
39 //==== ONLOAD_DELAY 90
40 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:stopDiscovery 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("BluetoothAdapter_stopDiscovery_successCallback_TypeMismatch", {timeout: 90000}), exceptionName, i,
46 powerOnError, powerOnSuccess, discoverDevicesError, errorCallback, conversionTable, successCallback, stopDiscoverySuccessCB;
48 conversionTable = getTypeConversionExceptions("functionObject", true);
50 errorCallback = t.step_func(function (e) {
51 assert_unreached("errorCallback exception:" + e.message);
54 stopDiscoverySuccessCB = t.step_func(function () {
58 discoverDevicesError = t.step_func(function (e) {
59 assert_unreached("discoverDevicesError exception:" + e.message);
62 powerOnSuccess = t.step_func(function () {
63 var discoverDevicesSuccessCallback = {
64 onstarted: function() {
65 for(i = 0; i < conversionTable.length; i++) {
66 successCallback = conversionTable[i][0];
67 exceptionName = conversionTable[i][1];
69 assert_throws({name : exceptionName},
71 adapter.stopDiscovery(successCallback, errorCallback);
72 }, exceptionName + " should be thrown - given incorrect successCallback.");
74 adapter.stopDiscovery(stopDiscoverySuccessCB);
76 ondevicefound: function(device) {
78 ondevicedisappeared: function(address) {
80 onfinished: function(devices) {
84 adapter.discoverDevices(discoverDevicesSuccessCallback,discoverDevicesError);
87 powerOnError = t.step_func(function (e) {
88 assert_unreached("powerOnError exception:" + e.message);
91 adapter = tizen.bluetooth.getDefaultAdapter();
92 adapter.setPowered(true, powerOnSuccess, powerOnError);