3 Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 Licensed under the Apache License, Version 2.0 (the License);
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
18 Huimei Xiong<hm86.xiong@samsung.com>
23 <title>BluetoothHealthProfileHandler_connectToSource_with_succCallback</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
26 <script src="support/bluetooth_common.js"></script>
31 //==== TEST:BluetoothHealthProfileHandler_connectToSource_with_succCallback
32 //==== LABEL Check BluetoothHealthProfileHandler::connectToSource() method without error callback.
34 //==== ONLOAD_DELAY 60
35 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothHealthProfileHandler:connectToSource M
36 //==== SPEC_URL https://developer.tizen.org/dev-guide/2.2.1/org.tizen.web.device.apireference/tizen/bluetooth.html
37 //==== 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.
38 //==== TEST_CRITERIA MMINA
40 setup({timeout: 60000});
42 var adapter = null, t = async_test(document.title, {timeout: 60000}), registerHealthApp, healthProfileHandler, bluetoothDevice,
43 powerOnSuccess, onRegisterSucc, onRegisterError, onGetDeviceSucc, onGetDeviceError, healthConnectSuccess;
47 healthConnectSuccess = t.step_func(function(channel) {
52 onGetDeviceSucc = t.step_func(function(device) {
53 bluetoothDevice = device;
55 healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess);
57 assert_unreached("connectToSource has error" + e.message);
61 onGetDeviceError = t.step_func(function(e) {
62 assert_unreached("onGetDeviceError:" + e.message);
65 onRegisterSucc = t.step_func(function(app) {
66 registerHealthApp = app;
67 adapter.getDevice(REMOTE_HEALTH_DEVICE_ADDRESS, onGetDeviceSucc, onGetDeviceError);
70 onRegisterError = t.step_func(function(e) {
71 assert_unreached("onRegisterError should not be invoked:" + e.message);
74 powerOnSuccess = t.step_func(function() {
76 healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
77 healthProfileHandler.registerSinkApplication(4100, testSinkApp, onRegisterSucc, onRegisterError);
79 assert_unreached("registerSinkApplication has error: " + e.message);
83 adapter = tizen.bluetooth.getDefaultAdapter();
84 setPowered (t, adapter, powerOnSuccess);