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>BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared</title>
27 <script src="support/unitcommon.js"></script>
28 <script src="support/bluetooth_common.js"></script>
34 //==== TEST: BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared
35 //==== LABEL Check if BluetoothDiscoverDevicesSuccessCallback callback is called and if its ondevicedisappeared arguments have proper type
36 //==== EXECUTION_TYPE manual
37 //==== STEP Disable the bluetooth of the remote device after pop-up is launched on test device.
38 //==== EXPECT ondevicedisappeared callback is invoked.
39 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothDiscoverDevicesSuccessCallback:ondevicedisappeared 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 device MUST be turned on and discoverable from other devices.
42 //==== TEST_CRITERIA CBT CBOA
43 setup({timeout: 90000});
44 var adapter = null, t = async_test(document.title, {timeout: 90000}),
45 stopDiscoverySuccess, discoverDevicesErrorCB, discoverDevicesSuccessOneCB, discoverDevicesSuccessTwoCB, flag = false;
49 discoverDevicesErrorCB = t.step_func(function (e) {
50 assert_unreached("discoverDevicesErrorCB exception:" + e.message);
53 discoverDevicesSuccessTwoCB = {
54 onstarted: t.step_func(function () {
56 ondevicefound: t.step_func(function (device) {
58 ondevicedisappeared: t.step_func(function (address) {
59 assert_type(address, "string", "address has wrong type");
60 if(address === REMOTE_DEVICE_ADDRESS) {
64 onfinished: t.step_func(function (devices) {
68 adapter.discoverDevices(discoverDevicesSuccessTwoCB, discoverDevicesErrorCB);
73 discoverDevicesSuccessOneCB = {
74 onstarted: t.step_func(function () {
76 ondevicefound: t.step_func(function (device) {
78 ondevicedisappeared: t.step_func(function (address) {
80 onfinished: t.step_func(function (devices) {
81 if (devices.length !== 0 ){
82 adapter.discoverDevices(discoverDevicesSuccessTwoCB, discoverDevicesErrorCB);
83 alert("Please disable bluetooth on other device");
85 assert_unreached("No devices was found");
90 stopDiscoverySuccess = t.step_func(function () {
91 adapter.discoverDevices(discoverDevicesSuccessOneCB, discoverDevicesErrorCB);
94 adapter = tizen.bluetooth.getDefaultAdapter();
95 stopDiscovery(t, adapter, stopDiscoverySuccess);