2a16e1a0f76bb3c2c65e68abde41948f8330f757
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3
4 Copyright (c) 2013 Samsung Electronics Co., Ltd. All Rights Reserved
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         Arkadiusz Pietraszek <a.pietraszek@samsung.com>
23
24 -->
25 <html>
26 <head>
27 <title>BluetoothDevice_connectToServiceByUUID_with_errorCallback</title>
28 <script src="support/unitcommon.js"></script>
29 <script src="support/bluetooth_common.js"></script>
30 </head>
31 <body>
32
33 <div id="log"></div>
34 <script>
35 //==== TEST: BluetoothDevice_connectToServiceByUUID_with_errorCallback
36 //==== LABEL Check connectToServiceByUUID with errorCallback
37 //==== PRIORITY P1
38 //==== EXECUTION_TYPE manual
39 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothDevice:connectToServiceByUUID M
40 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
41 //==== PRE The bluetooth of the remote/test device MUST be turned on and discoverable from other devices. The remote device MUST register the service by pushing [Register service] button on tct-bt-helper.
42 //==== TEST_CRITERIA MOA MAST
43 setup({timeout: 180000});
44 var adapter = null, t = async_test(document.title, {timeout: 180000}),
45     onSocketConnect, onSocketError, onBondingSuccess, onBondingError, powerOnSuccess;
46 t.step(function () {
47
48     add_result_callback(function() {
49         clearBonding(REMOTE_DEVICE_ADDRESS);
50     });
51
52     onSocketConnect = t.step_func(function (socket) {
53         if(socket.state === "OPEN") {
54             t.done();
55         } else {
56             assert_unreached("Socket is closed");
57         }
58     });
59
60     onSocketError = t.step_func(function (e) {
61         assert_unreached("onSocketError exception:" + e.message);
62     });
63
64     onBondingSuccess = t.step_func(function (device) {
65         device.connectToServiceByUUID(CHAT_SERVICE_UUID, onSocketConnect, onSocketError);
66     });
67
68     onBondingError = t.step_func(function (e) {
69         assert_unreached("onBondingError exception:" + e.message);
70     });
71
72     powerOnSuccess = t.step_func(function () {
73         adapter.createBonding(REMOTE_DEVICE_ADDRESS, onBondingSuccess, onBondingError);
74     });
75
76     adapter = tizen.bluetooth.getDefaultAdapter();
77     setPowered(t, adapter, powerOnSuccess);
78 });
79
80 </script>
81 </body>
82 </html>