2e1e4d31b380d22ce39988da10c8fda3fb1d9973
[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         Lukasz Bardeli <l.bardeli@samsung.com>
22
23 -->
24 <html>
25 <head>
26 <title>BluetoothAdapter_discoverDevices_successCallback_invalid_cb</title>
27 <script src="../resources/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
29 </head>
30 <body>
31
32 <div id="log"></div>
33 <script>
34 //==== TEST: BluetoothAdapter_discoverDevices_successCallback_invalid_cb
35 //==== LABEL Check discoverDevices argument successCallback validation - use simple function
36 //==== PRIORITY P2
37 //==== STEP check argument discoverDevices successCallback validation.
38 //==== EXPECT argument discoverDevices successCallback validation checked.
39 //==== ONLOAD_DELAY 90
40 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:discoverDevices M
41 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
42 //==== TEST_CRITERIA MTCB
43 setup({timeout: 90000});
44
45 var adapter = null,t = async_test("BluetoothAdapter_discoverDevices_successCallback_invalid_cb", {timeout: 90000}),exceptionName = "TypeMismatchError",incorrectListeners,
46     incorrectCallback, i, powerOnError, powerOnSuccess, discoverDevicesError;
47 t.step(function () {
48     incorrectListeners = getListenerConversionExceptions(["onstarted", "ondevicefound", "ondevicedisappeared", "onfinished"]);
49
50     discoverDevicesError = t.step_func(function (e) {
51         assert_unreached("discoverDevicesError exception:" + e.message);
52     });
53
54     powerOnSuccess = t.step_func(function () {
55         for(i = 0; i < incorrectListeners.length; i++) {
56             incorrectCallback  = incorrectListeners[i][0];
57             exceptionName = incorrectListeners[i][1];
58             assert_throws({name : exceptionName},
59                 function () {
60                     adapter.discoverDevices(incorrectCallback, discoverDevicesError);
61                 }, exceptionName + " should be thrown - given incorrect successCallback.");
62         }
63         t.done();
64     });
65
66     powerOnError = t.step_func(function (e) {
67         assert_unreached("powerOnError exception:" + e.message);
68     });
69
70     adapter = tizen.bluetooth.getDefaultAdapter();
71     adapter.setPowered(true, powerOnSuccess, powerOnError);
72 });
73 </script>
74 </body>
75 </html>