[tv][bluetooth]onfinish timeout time too long,add stopdiscovery 45/315845/2
authorchen <chen89.chen@samsung.com>
Thu, 5 Dec 2024 23:06:18 +0000 (07:06 +0800)
committerchen chen <chen89.chen@samsung.com>
Thu, 5 Dec 2024 07:08:11 +0000 (07:08 +0000)
Change-Id: Icc7c82c8d581662d3f3d046439bd5081c73711b7
Signed-off-by: chen <chen89.chen@samsung.com>
common/tct-bluetooth-tizen-tests/bluetooth/BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared.html

index 3e5a9607f06f1a2844f0b58acfe92b2003c366fd..8245181d5d4a49c07db42f7572936ca64d9cd749 100755 (executable)
-<!DOCTYPE html>\r
-<!--\r
-\r
-Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
-\r
-Licensed under the Apache License, Version 2.0 (the License);\r
-you may not use this file except in compliance with the License.\r
-You may obtain a copy of the License at\r
-\r
-    http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-Unless required by applicable law or agreed to in writing, software\r
-distributed under the License is distributed on an "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-See the License for the specific language governing permissions and\r
-limitations under the License.\r
-\r
-\r
-\r
-Authors:\r
-        Lukasz Bardeli <l.bardeli@samsung.com>\r
-\r
--->\r
-<html>\r
-\r
-<head>\r
-<title>BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared</title>\r
-<script src="support/unitcommon.js"></script>\r
-<script src="support/bluetooth_common.js"></script>\r
-</head>\r
-\r
-<body>\r
-\r
-<div id="log"></div>\r
-<script>\r
-//==== TEST: BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared\r
-//==== LABEL Check if BluetoothDiscoverDevicesSuccessCallback callback is called and if its ondevicedisappeared arguments have proper type\r
-//==== PRIORITY P1\r
-//==== EXECUTION_TYPE manual\r
-//==== STEP Disable the bluetooth of the remote device after pop-up is launched on test device.\r
-//==== EXPECT ondevicedisappeared callback is invoked.\r
-//==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothDiscoverDevicesSuccessCallback:ondevicedisappeared M\r
-//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html\r
-//==== PRE The bluetooth of the remote/test device MUST be turned on and discoverable from other devices.\r
-//==== TEST_CRITERIA CBT CBOA\r
-setup({ timeout: 180000 });\r
-var adapter = null, t = async_test(document.title, { timeout: 180000 }),\r
-    stopDiscoverySuccess, discoverDevicesErrorCB, discoverDevicesSuccessOneCB, discoverDevicesSuccessTwoCB, flag = false;\r
-\r
-t.step(function () {\r
-    if (BT_SUPPORT) { // network.bluetooth support\r
-        discoverDevicesErrorCB = t.step_func(function (e) {\r
-            assert_unreached("discoverDevicesErrorCB exception:" + e.message);\r
-        });\r
-\r
-        discoverDevicesSuccessTwoCB = {\r
-            onstarted: t.step_func(function () {\r
-            }),\r
-            ondevicefound: t.step_func(function (device) {\r
-            }),\r
-            ondevicedisappeared: t.step_func(function (address) {\r
-                assert_type(address, "string", "address has wrong type");\r
-                if (address === REMOTE_DEVICE_ADDRESS) {\r
-                    flag = true;\r
-                }\r
-            }),\r
-            onfinished: t.step_func(function (devices) {\r
-                if (flag) {\r
-                    t.done();\r
-                } else {\r
-                    adapter.discoverDevices(discoverDevicesSuccessTwoCB, discoverDevicesErrorCB);\r
-                }\r
-            })\r
-        };\r
-\r
-        discoverDevicesSuccessOneCB = {\r
-            onstarted: t.step_func(function () {\r
-            }),\r
-            ondevicefound: t.step_func(function (device) {\r
-            }),\r
-            ondevicedisappeared: t.step_func(function (address) {\r
-            }),\r
-            onfinished: t.step_func(function (devices) {\r
-                if (devices.length > 0) {\r
-                    found = false;\r
-                    for (var i = 0; i < devices.length; i++) {\r
-                        if (devices[i].address === REMOTE_DEVICE_ADDRESS) {\r
-                            found = true;\r
-                            break;\r
-                        }\r
-                    }\r
-                    if (found === false) {\r
-                        assert_unreached("Device not found:" + REMOTE_DEVICE_ADDRESS);\r
-                    }\r
-                    alert("Please disable bluetooth on the other device, then close this alert");\r
-                    adapter.discoverDevices(discoverDevicesSuccessTwoCB, discoverDevicesErrorCB);\r
-                } else {\r
-                    setTimeout(stopDiscoverySuccess, 1000);\r
-                }\r
-            })\r
-        };\r
-\r
-        stopDiscoverySuccess = t.step_func(function () {\r
-            adapter.discoverDevices(discoverDevicesSuccessOneCB, discoverDevicesErrorCB);\r
-        });\r
-\r
-        adapter = tizen.bluetooth.getDefaultAdapter();\r
-        stopDiscovery(t, adapter, stopDiscoverySuccess);\r
-\r
-    } else {\r
-        t.done();\r
-    }\r
-});\r
-\r
-</script>\r
-</body>\r
-\r
+<!DOCTYPE html>
+<!--
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd.
+
+Licensed under the Apache License, Version 2.0 (the License);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+Authors:
+        Lukasz Bardeli <l.bardeli@samsung.com>
+
+-->
+<html>
+
+<head>
+<title>BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared</title>
+<script src="support/unitcommon.js"></script>
+<script src="support/bluetooth_common.js"></script>
+</head>
+
+<body>
+
+<div id="log"></div>
+<script>
+//==== TEST: BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared
+//==== LABEL Check if BluetoothDiscoverDevicesSuccessCallback callback is called and if its ondevicedisappeared arguments have proper type
+//==== PRIORITY P1
+//==== EXECUTION_TYPE manual
+//==== STEP Disable the bluetooth of the remote device after pop-up is launched on test device.
+//==== EXPECT ondevicedisappeared callback is invoked.
+//==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothDiscoverDevicesSuccessCallback:ondevicedisappeared M
+//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
+//==== PRE The bluetooth of the remote/test device MUST be turned on and discoverable from other devices.
+//==== TEST_CRITERIA CBT CBOA
+setup({ timeout: 180000 });
+var adapter = null, t = async_test(document.title, { timeout: 180000 }),
+    stopDiscoverySuccess, discoverDevicesErrorCB, discoverDevicesSuccessOneCB, discoverDevicesSuccessTwoCB, flag = false;
+
+t.step(function () {
+    if (BT_SUPPORT) { // network.bluetooth support
+        discoverDevicesErrorCB = t.step_func(function (e) {
+            assert_unreached("discoverDevicesErrorCB exception:" + e.message);
+        });
+
+        discoverDevicesSuccessTwoCB = {
+            onstarted: t.step_func(function () {
+            }),
+            ondevicefound: t.step_func(function (device) {
+            }),
+            ondevicedisappeared: t.step_func(function (address) {
+                assert_type(address, "string", "address has wrong type");
+                if (address === REMOTE_DEVICE_ADDRESS) {
+                    flag = true;
+                }
+            }),
+            onfinished: t.step_func(function (devices) {
+                if (flag) {
+                    t.done();
+                } else {
+                    adapter.discoverDevices(discoverDevicesSuccessTwoCB, discoverDevicesErrorCB);
+                }
+            })
+        };
+
+        discoverDevicesSuccessOneCB = {
+            onstarted: t.step_func(function () {
+            }),
+            ondevicefound: t.step_func(function (device) {
+                if (device.address === REMOTE_DEVICE_ADDRESS) {
+                    stopDiscovery(t, adapter, stopDiscoverySuccess1);
+                }
+            }),
+            ondevicedisappeared: t.step_func(function (address) {
+
+            }),
+            onfinished: t.step_func(function (devices) {
+                if (devices.length > 0) {
+                    found = false;
+                    for (var i = 0; i < devices.length; i++) {
+                        if (devices[i].address === REMOTE_DEVICE_ADDRESS) {
+                            found = true;
+                            break;
+                        }
+                    }
+                    if (found === false) {
+                        assert_unreached("Device not found:" + REMOTE_DEVICE_ADDRESS);
+                    }
+                    alert("Please disable bluetooth on the other device, then close this alert");
+                    adapter.discoverDevices(discoverDevicesSuccessTwoCB, discoverDevicesErrorCB);
+                } else {
+                    setTimeout(stopDiscoverySuccess, 1000);
+                }
+            })
+        };
+
+        stopDiscoverySuccess = t.step_func(function () {
+            adapter.discoverDevices(discoverDevicesSuccessOneCB, discoverDevicesErrorCB);
+        });
+
+        stopDiscoverySuccess1 = t.step_func(function () {
+        });
+
+        adapter = tizen.bluetooth.getDefaultAdapter();
+        stopDiscovery(t, adapter, stopDiscoverySuccess);
+
+    } else {
+        t.done();
+    }
+});
+
+</script>
+</body>
+
 </html>
\ No newline at end of file