[Bluetooth] cleaning after the test
authorWitold Choinkowski <w.choinkowsk@samsung.com>
Thu, 29 Aug 2013 11:10:31 +0000 (13:10 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 6 Sep 2013 12:51:50 +0000 (12:51 +0000)
Change-Id: I07d89db9f4191e91b98e5f48e8b89ac32d55c577

35 files changed:
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_callback_onerror.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_callback_successful.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_registerRFCOMMServiceByUUID.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_registerRFCOMMServiceByUUID_onconnect_successful.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_registerRFCOMMServiceByUUID_onerror.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_registerRFCOMMServiceByUUID_with_errorCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplicationSuccessCallback_onsuccess.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_dataType_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_extend.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_name_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_onconnect_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_unregister.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_unregister_errorCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_unregister_errorCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_unregister_exist.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthApplication_unregister_successCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthProfileHandler_registerSinkApplication.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothHealthProfileHandler_registerSinkApplication_with_errorCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_extend.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_isConnected_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_name_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_onconnect_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_errorCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_errorCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_exist.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_successCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_successCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_unregisterServiceRecord.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_with_errorCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_with_successCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_uuid_attribute.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceSuccessCallback_onsuccess.html
tct-bluetooth-tizen-tests/bluetooth/support/bluetooth_common.js
tct-bluetooth-tizen-tests/tests.xml

index 6385065def372ee39bd842f6737d058a8b57aecb..8166ca32f0583f0a8ff3da7cf747865be08d6e7d 100644 (file)
@@ -56,7 +56,6 @@ t.step(function () {
     };
     errorCallback = t.step_func(function (error) {
         assert_equals(error.name, "ServiceNotAvailableError", "expected another error");
-        adapter.stopDiscovery();
 
         t.done();
     });
index 14865064dc4393734ffeb6eca47e2679b2668c4d..01b582a037e7513a6b286af08962a9720ae6f359 100644 (file)
@@ -46,18 +46,14 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:discoverDevices M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MOA MAST
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 var t = async_test("BluetoothAdapter_discoverDevices_callback_successful",{timeout: 90000});
 t.step(function () {
-    var adapter, discoverDevicesErrorCallback, startDiscoveryDevice, discoverDevicesSuccessCallback, stopDiscoverySuccessCB;
-
-    stopDiscoverySuccessCB = t.step_func(function () {
-        t.done();
-    });
+    var adapter, discoverDevicesErrorCallback, startDiscoveryDevice, discoverDevicesSuccessCallback;
 
     discoverDevicesSuccessCallback = {
         onstarted: t.step_func(function () {
-            adapter.stopDiscovery(stopDiscoverySuccessCB);
+            t.done();
         }),
         ondevicefound: t.step_func(function (device) {
         }),
@@ -76,6 +72,7 @@ t.step(function () {
     });
 
     adapter = tizen.bluetooth.getDefaultAdapter();
+    setBluetoothDiscoveryCleanup(adapter);
     adapter.setPowered(true, startDiscoveryDevice);
 });
 </script>
index 347c3e8a9d1d6c5c695aa2a4df9acc86010c1c0b..260793a02f48985823d5849ef28d498b2cce727b 100644 (file)
@@ -46,20 +46,21 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:registerRFCOMMServiceByUUID M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MMINA MAST MR
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter = null,t = async_test("BluetoothAdapter_registerRFCOMMServiceByUUID",{ timeout: 90000 }), registerRFCOMMServiceByUUIDSuccess,
     powerOnSuccess, powerOnError, retValue = null;
 t.step(function () {
 
-    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (recordHandler) {
-        assert_true("uuid" in recordHandler, "No uuid in recordHandler");
-        assert_true("name" in recordHandler, "No name in recordHandler");
-        assert_true("isConnected" in recordHandler, "No isConnected in recordHandler");
-        assert_true("onconnect" in recordHandler, "No onconnect in recordHandler");
-        assert_type(recordHandler.unregister, "function", "Method unregister does not exist.");
-        recordHandler.unregister();
+    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        assert_true("uuid" in handler, "No uuid in recordHandler");
+        assert_true("name" in handler, "No name in recordHandler");
+        assert_true("isConnected" in handler, "No isConnected in recordHandler");
+        assert_true("onconnect" in handler, "No onconnect in recordHandler");
+        assert_type(handler.unregister, "function", "Method unregister does not exist.");
 
         assert_equals(retValue, undefined, "registerRFCOMMServiceByUUID returns wrong value");
+
         t.done();
     });
 
index 9d47e96affb62818bb7bee3f69ce2fb669e7f888..6a39c08205f12dae3290f122fc58b0e257dd5928 100644 (file)
@@ -52,24 +52,15 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== PRE tct-bt-helper MUST be launched on the remote device.
 //==== TEST_CRITERIA MOA MAST
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter = null,t = async_test("BluetoothAdapter_registerRFCOMMServiceByUUID_onconnect_successful",{timeout:90000}),
-    registerRFCOMMServiceByUUIDSuccess, registerRFCOMMServiceByUUIDError, powerOnSuccess, powerOnError, serviceHandler,
+    registerRFCOMMServiceByUUIDSuccess, registerRFCOMMServiceByUUIDError, powerOnSuccess, powerOnError,
     visibleSuccess, visibleError;
 t.step(function () {
 
-    add_result_callback(function (res) {
-        serviceHandler.unregister();
-    });
-
-    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (recordHandler) {
-        serviceHandler = recordHandler;
-        recordHandler.onconnect = t.step_func(function (socket) {
-            if(recordHandler !== null) {
-                recordHandler.unregister(function() {
-                    recordHandler = null;
-                });
-            }
+    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        handler.onconnect = t.step_func(function (socket) {
             t.done();
         });
         alert("1. Push \"Search\" button on the remote device.\n" +
index 46f02b91dbdb7f7fae26c802140c6835bc63f579..b94873b9fa7d9c2b2481879f33335369855ce151 100644 (file)
@@ -45,29 +45,24 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:registerRFCOMMServiceByUUID M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA MERRCB
 
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var t = async_test("BluetoothAdapter_registerRFCOMMServiceByUUID_onerror", {timeout: 90000}),
-    adapter, powerOffSuccess, powerOffError, chatServiceSuccessCallback, chatServiceErrorCallback, serviceHandler;
+    adapter, powerOffSuccess, powerOffError, chatServiceSuccessCallback, chatServiceErrorCallback;
 
 t.step(function () {
-    add_result_callback(function (res) {
-        if (serviceHandler) {
-            serviceHandler.unregister();
-        }
-    });
 
     chatServiceSuccessCallback = t.step_func(function (handler) {
-        serviceHandler = handler;
+        setBluetoothHandlerCleanup(handler);
         assert_unreached("Shouldn't be here");
     });
 
     chatServiceErrorCallback = t.step_func(function (e) {
         assert_equals(e.name, "ServiceNotAvailableError", "error name in chatServiceErrorCallback");
         t.done();
+        done();
     });
 
     powerOffSuccess = t.step_func(function () {
index b2d2a5281635727c4359350358d24c8017a1c646..5ce7f62d257b2e13166bb13911ac3b4d5776b9fc 100644 (file)
@@ -46,24 +46,20 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:registerRFCOMMServiceByUUID M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MOA
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var adapter = null,t = async_test("BluetoothAdapter_registerRFCOMMServiceByUUID_with_errorCallback", {timeout: 90000}),
-    registerRFCOMMServiceByUUIDSuccess, registerRFCOMMServiceByUUIDError, powerOnSuccess, powerOnError, serviceHandler;
+    registerRFCOMMServiceByUUIDSuccess, registerRFCOMMServiceByUUIDError, powerOnSuccess, powerOnError;
 t.step(function () {
 
-    add_result_callback(function (res) {
-        serviceHandler.unregister();
-    });
-
     registerRFCOMMServiceByUUIDSuccess = t.step_func(function (recordHandler) {
-        serviceHandler = recordHandler;
+        setBluetoothHandlerCleanup(recordHandler);
         assert_true("uuid" in recordHandler, "No uuid in recordHandler");
         assert_true("name" in recordHandler, "No name in recordHandler");
         assert_true("isConnected" in recordHandler, "No isConnected in recordHandler");
         assert_true("onconnect" in recordHandler, "No onconnect in recordHandler");
         assert_type(recordHandler.unregister, "function", "Method unregister does not exist.");
-        recordHandler.unregister();
+
         t.done();
     });
 
index c5afedf9ca8c87a86362056e513bd3b2c9f391eb..a9ce5fcd8687e68474f96a2ddcde071da5a91985 100644 (file)
@@ -38,13 +38,14 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA CBT CBOA
 
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var adapter, t = async_test("BluetoothHealthApplicationSuccessCallback_onsuccess", {timeout: 90000}), healthProfileHandler,
     powerOnSuccess, powerOnError, healthRegisterSuccess;
 t.step(function () {
 
     healthRegisterSuccess = t.step_func(function (app) {
+        setBluetoothHandlerCleanup(app);
         assert_type(app, "object", "argument app has wrong type");
 
         assert_true("dataType" in app, "no dataType attribute in BluetoothHealthApplication");
index 07d3aac803e1e5993e7fd08a10b2afb9ab58bb6e..0a71e4fb1f6ab0cd7fba26fb2c1e21193626ec59 100644 (file)
@@ -39,21 +39,21 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html\
 //==== TEST_CRITERIA AE AT ARO
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler,powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_dataType_attribute", {timeout:90000}), appName = "testSinkApp";
 
 t.step(function () {
-    adapter = tizen.bluetooth.getDefaultAdapter();
 
-    healthRegisterSuccess = t.step_func(function (registerHealthApp) {
-        assert_equals(registerHealthApp.dataType, REMOTE_HEALTH_DEVICE_TYPE, "dataType in BluetoothHealthApplication has wrong value");
-        assert_type(registerHealthApp.dataType, "unsigned short", "dataType in BluetoothHealthApplication has wrong type");
+    adapter = tizen.bluetooth.getDefaultAdapter();
 
-        registerHealthApp.dataType = 4103;
-        assert_equals(registerHealthApp.dataType, REMOTE_HEALTH_DEVICE_TYPE, "dataType in BluetoothHealthApplication is writable");
+    healthRegisterSuccess = t.step_func(function (healthApp) {
+        setBluetoothHandlerCleanup(healthApp);
+        assert_equals(healthApp.dataType, REMOTE_HEALTH_DEVICE_TYPE, "dataType in BluetoothHealthApplication has wrong value");
+        assert_type(healthApp.dataType, "unsigned short", "dataType in BluetoothHealthApplication has wrong type");
 
-        registerHealthApp.unregister();
+        healthApp.dataType = 4103;
+        assert_equals(healthApp.dataType, REMOTE_HEALTH_DEVICE_TYPE, "dataType in BluetoothHealthApplication is writable");
 
         t.done();
     });
index cb5c90ee4b25365b84e0552f7b067e39c8d627fc..cff08732e9b8bdc465ed6a3fabfa7bdebf5689e9 100644 (file)
@@ -39,17 +39,16 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html\
 //==== TEST_CRITERIA OBX
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler,powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_extend", {timeout:90000});
 
 t.step(function () {
     adapter = tizen.bluetooth.getDefaultAdapter();
 
-    healthRegisterSuccess = t.step_func(function (registerHealthApp) {
-        check_extensibility(registerHealthApp);
-
-        registerHealthApp.unregister();
+    healthRegisterSuccess = t.step_func(function (healthApp) {
+        setBluetoothHandlerCleanup(healthApp);
+        check_extensibility(healthApp);
 
         t.done();
     });
index b059bdae734eb79c4a3a8004e7fc7027964fe997..6b8398a2ea19503ea2df4220fdc8ebdcf0403729 100644 (file)
@@ -39,21 +39,20 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html\
 //==== TEST_CRITERIA AE AT ARO
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler,powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_name_attribute", {timeout:90000}), appName = "testSinkApp";
 
 t.step(function () {
     adapter = tizen.bluetooth.getDefaultAdapter();
 
-    healthRegisterSuccess = t.step_func(function (registerHealthApp) {
-        assert_equals(registerHealthApp.name, appName, "name in BluetoothHealthApplication has wrong value");
-        assert_type(registerHealthApp.name, "string", "name in BluetoothHealthApplication has wrong type");
+    healthRegisterSuccess = t.step_func(function (healthApp) {
+        setBluetoothHandlerCleanup(healthApp);
+        assert_equals(healthApp.name, appName, "name in BluetoothHealthApplication has wrong value");
+        assert_type(healthApp.name, "string", "name in BluetoothHealthApplication has wrong type");
 
-        registerHealthApp.name = "testName";
-        assert_equals(registerHealthApp.name, appName, "name in BluetoothHealthApplication is writable");
-
-        registerHealthApp.unregister();
+        healthApp.name = "testName";
+        assert_equals(healthApp.name, appName, "name in BluetoothHealthApplication is writable");
 
         t.done();
     });
index 3f2f1188b795b3f181757bb4c8478e5004d982e6..c1eeef878603db7883f0bb7e6a069496f3868b4e 100644 (file)
@@ -39,21 +39,20 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html\
 //==== TEST_CRITERIA AE ADV ASG AT
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler,powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError, testOnconnect,
     t = async_test("BluetoothHealthApplication_onconnect_attribute", {timeout:90000}), appName = "testSinkApp";
 
 t.step(function () {
     adapter = tizen.bluetooth.getDefaultAdapter();
 
-    healthRegisterSuccess = t.step_func(function (registerHealthApp) {
-        assert_equals(registerHealthApp.onconnect, null, "onconnect in BluetoothHealthApplication has wrong default value");
+    healthRegisterSuccess = t.step_func(function (healthApp) {
+        setBluetoothHandlerCleanup(healthApp);
+        assert_equals(healthApp.onconnect, null, "onconnect in BluetoothHealthApplication has wrong default value");
 
         testOnconnect = function () {};
-        registerHealthApp.onconnect = testOnconnect;
-        assert_equals(registerHealthApp.onconnect, testOnconnect, "onconnect in BluetoothHealthApplication is not writable");
-
-        registerHealthApp.unregister();
+        healthApp.onconnect = testOnconnect;
+        assert_equals(healthApp.onconnect, testOnconnect, "onconnect in BluetoothHealthApplication is not writable");
 
         t.done();
     });
index 5ecc1f71a74a090de0ab42101c836b4d726692ce..913f22eaddfe529022ad05efb538570818d59c12 100644 (file)
@@ -39,7 +39,7 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MMINA MR
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler,powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_unregister", {timeout:90000}), appName = "testSinkApp", retValue = null;
 
@@ -47,6 +47,7 @@ t.step(function () {
     adapter = tizen.bluetooth.getDefaultAdapter();
 
     healthRegisterSuccess = t.step_func(function (registerHealthApp) {
+        setBluetoothHandlerCleanup(registerHealthApp);
         retValue = registerHealthApp.unregister();
 
         assert_equals(retValue, undefined, "unregister returns wrong value");
index ec13da887e513acc74b63b64b2b25e52afc0fd36..d82ff2b4c662f1e62b83cf2f292f26c29fa9f9ba 100644 (file)
@@ -39,7 +39,7 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MC
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler, powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_unregister_errorCallback_TypeMismatch", {timeout:90000}), appName = "testSinkApp",
     argument, exceptionName, i, conversionTable = getTypeConversionExceptions("functionObject", true), successCallback;
@@ -52,6 +52,7 @@ t.step(function () {
     });
 
     healthRegisterSuccess = t.step_func(function (registerHealthApp) {
+        setBluetoothHandlerCleanup(registerHealthApp);
         for(i = 0; i < conversionTable.length; i++) {
             argument = conversionTable[i][0];
             exceptionName = conversionTable[i][1];
@@ -62,8 +63,6 @@ t.step(function () {
                 }, exceptionName + " should be thrown - given incorrect argument.");
         }
 
-        registerHealthApp.unregister();
-
         t.done();
     });
 
index 85e136db6836f0981ef4f7588b3b9d0576020e12..3b17e387d3c84279a5115d5581d0d732e332ca52 100644 (file)
@@ -39,7 +39,7 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MTCB
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler, powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_unregister_errorCallback_invalid_cb", {timeout:90000}), appName = "testSinkApp",
     incorrectCallback, exceptionName = "TypeMismatchError", successCallback;
@@ -58,13 +58,12 @@ t.step(function () {
     });
 
     healthRegisterSuccess = t.step_func(function (registerHealthApp) {
+        setBluetoothHandlerCleanup(registerHealthApp);
         assert_throws({name : exceptionName},
             function () {
                 registerHealthApp.unregister(successCallback, incorrectCallback);
             }, exceptionName + " should be thrown - given incorrect argument.");
 
-        registerHealthApp.unregister();
-
         t.done();
     });
 
index c76b7906985299d939acf7ee3125613effb30ca5..2345f496689884a7e15995526c101797f9bdc658 100644 (file)
@@ -39,18 +39,17 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html\
 //==== TEST_CRITERIA ME
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler,powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_unregister_exist", {timeout:90000}), appName = "testSinkApp";
 
 t.step(function () {
     adapter = tizen.bluetooth.getDefaultAdapter();
 
-    healthRegisterSuccess = t.step_func(function (registerHealthApp) {
-        assert_true("unregister" in  registerHealthApp, "unregister does not exist.");
-        check_method_exists(registerHealthApp, "unregister");
-
-        registerHealthApp.unregister();
+    healthRegisterSuccess = t.step_func(function (healthApp) {
+        setBluetoothHandlerCleanup(healthApp);
+        assert_true("unregister" in  healthApp, "unregister does not exist.");
+        check_method_exists(healthApp, "unregister");
 
         t.done();
     });
index 7af4d2f9eaca41141c982aefa16f263d365b9965..737c287f3083fcc6c338434d5f4e8ee991efa3d8 100644 (file)
@@ -39,7 +39,7 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MC
 
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, healthProfileHandler, powerOnSuccess , powerOnError, healthRegisterSuccess, healthRegisterError,
     t = async_test("BluetoothHealthApplication_unregister_successCallback_TypeMismatch", {timeout:90000}), appName = "testSinkApp",
     argument, exceptionName, i, conversionTable = getTypeConversionExceptions("functionObject", true);
@@ -48,6 +48,7 @@ t.step(function () {
     adapter = tizen.bluetooth.getDefaultAdapter();
 
     healthRegisterSuccess = t.step_func(function (registerHealthApp) {
+        setBluetoothHandlerCleanup(registerHealthApp);
         for(i = 0; i < conversionTable.length; i++) {
             argument = conversionTable[i][0];
             exceptionName = conversionTable[i][1];
@@ -58,8 +59,6 @@ t.step(function () {
                 }, exceptionName + " should be thrown - given incorrect argument.");
         }
 
-        registerHealthApp.unregister();
-
         t.done();
     });
 
index 2c08426f021200ed0797def826da12ad42300d22..cf39528bc1fca9d81a39448e3d873d6db54a7c90 100644 (file)
@@ -26,6 +26,7 @@ Authors:
 <head>
 <title>BluetoothHealthProfileHandler_registerSinkApplication</title>
 <script src="../resources/unitcommon.js"></script>
+<script src="support/bluetooth_common.js"></script>
 </head>
 <body>
 <div id="log"></div>
@@ -36,23 +37,17 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothHealthProfileHandler:registerSinkApplication M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MMINA MAST MR
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter, t = async_test("BluetoothHealthProfileHandler_registerSinkApplication", {timeout:90000}), healthProfileHandler,
-    unregisterSuccess, unregisterError, powerOnSuccess, powerOnError, healthRegisterSuccess, retValue = null;
+    powerOnSuccess, powerOnError, healthRegisterSuccess, retValue = null;
 t.step(function () {
 
-    unregisterSuccess = t.step_func(function () {
-        t.done();
-    });
-
-    unregisterError = t.step_func(function (e) {
-        assert_unreached("unregister exception:" + e.message);
-    });
-
     healthRegisterSuccess = t.step_func(function (app) {
+        setBluetoothHandlerCleanup(app);
         assert_type(app, "object", "argument app has wrong type");
         assert_equals(retValue, undefined, "registerSinkApplication returns wrong value");
-        app.unregister(unregisterSuccess, unregisterError);
+
+        t.done();
     });
 
     powerOnSuccess = t.step_func(function () {
index 1e13616902792dcc35fa2050b20f4e5b55479f8a..0ebb6c4c1e5f55cdcfe629cdc99d6de62672ae3e 100644 (file)
@@ -38,23 +38,17 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MOA MAST
 
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var adapter, t = async_test("BluetoothHealthProfileHandler_registerSinkApplication_with_errorCallback", {timeout: 90000}), healthProfileHandler,
-    unregisterSuccess, unregisterError, powerOnSuccess, powerOnError, healthRegisterSuccess, healthRegisterError;
+    powerOnSuccess, powerOnError, healthRegisterSuccess, healthRegisterError;
 t.step(function () {
 
-    unregisterSuccess = t.step_func(function () {
-        t.done();
-    });
-
-    unregisterError = t.step_func(function (e) {
-        assert_unreached("unregister exception:" + e.message);
-    });
-
     healthRegisterSuccess = t.step_func(function (app) {
+        setBluetoothHandlerCleanup(app);
         assert_type(app, "object", "argument app has wrong type");
-        app.unregister(unregisterSuccess, unregisterError);
+
+        t.done();
     });
 
     healthRegisterError = t.step_func(function (e) {
index deb0410ce462a32e793ccb7670f2f14fa2b5e3d6..8e3b6cdc738c9280d7a77efff4cecdd4c708bd4f 100644 (file)
@@ -38,14 +38,16 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:BluetoothServiceHandler U
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA OBX
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var adapter = null, t = async_test("BluetoothServiceHandler_extend", {timeout: 90000}), powerOnError, powerOnSuccess,
     registerRFCOMMServiceByUUIDError, registerRFCOMMServiceByUUIDSuccess;
 t.step(function () {
-    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (recordHandler) {
-        check_extensibility(recordHandler);
-        recordHandler.unregister();
+
+    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        check_extensibility(handler);
+
         t.done();
     });
 
index 02b166e49d016d3fc161d91288a0dd929ebdb915..75f8b3b2f1391fec4cb052e6866660af2303bb2c 100644 (file)
@@ -45,9 +45,8 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:isConnected A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA AE AT ARO
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var t = async_test("BluetoothServiceHandler_isConnected_attribute", {timeout: 90000});
 
@@ -55,11 +54,11 @@ t.step(function () {
     var adapter, powerOnSuccess, powerOnError, chatServiceSuccessCallback, chatServiceErrorCallback,
         isConnected;
 
-    chatServiceSuccessCallback = t.step_func(function (recordHandler) {
-        isConnected = recordHandler.isConnected;
-        check_readonly(recordHandler, "isConnected", isConnected, "boolean", !(isConnected));
+    chatServiceSuccessCallback = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        isConnected = handler.isConnected;
+        check_readonly(handler, "isConnected", isConnected, "boolean", !(isConnected));
 
-        recordHandler.unregister();
         t.done();
     });
 
index 6b8daf93957352ab9b27ce31b55bb8b7253195a3..bdc1509263037b71d60baeaa20e5f9f6735bd740 100644 (file)
@@ -45,9 +45,8 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:name A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA AE AT ARO
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var t = async_test("BluetoothServiceHandler_name_attribute", {timeout: 90000});
 
@@ -55,10 +54,11 @@ t.step(function () {
     var adapter, powerOnSuccess, powerOnError, chatServiceSuccessCallback, chatServiceErrorCallback,
         name;
 
-    chatServiceSuccessCallback = t.step_func(function (recordHandler) {
-        name = recordHandler.name;
-        check_readonly(recordHandler, "name", name, "string", name+"1234");
-        recordHandler.unregister();
+    chatServiceSuccessCallback = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        name = handler.name;
+        check_readonly(handler, "name", name, "string", name+"1234");
+
         t.done();
     });
 
index 79335b77cbefc3f5e6032864c45ef4162702ec10..c18e7edb12ef5e44af55510b06bd7cebf6afe0ec 100644 (file)
@@ -44,11 +44,11 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== PRE tct-bt-helper MUST be launched on the remote device.
 //==== TEST_CRITERIA ASG AE AT ADV
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var this_test = async_test("BluetoothServiceHandler_onconnect_attribute", {timeout: 90000});
 this_test.step(function () {
     var adapter, self, onError, TestMessage, registerSuccessCallback, sendMsg, chatServiceHandler,
-        data, recvmsg, checkmsg, i, expectedMsgFromClient, sendMsgData, MsgToClient, serviceHandler, visibleSuccess, visibleError;
+        data, recvmsg, checkmsg, i, expectedMsgFromClient, sendMsgData, MsgToClient, visibleSuccess, visibleError, poweredSuccess;
     adapter = tizen.bluetooth.getDefaultAdapter();
     self = this;
     onError = self.step_func(function (e) {
@@ -56,12 +56,8 @@ this_test.step(function () {
     });
     TestMessage = "registerRFCOMMServiceByUUID";
 
-    add_result_callback(function (res) {
-        serviceHandler.unregister();
-    });
-
     registerSuccessCallback = self.step_func(function (handler) {
-        serviceHandler = handler;
+        setBluetoothHandlerCleanup(handler);
         sendMsg = "";
 
         chatServiceHandler = handler;
@@ -96,10 +92,6 @@ this_test.step(function () {
                 sendMsgData(MsgToClient);
             };
 
-            socket.onclose = function () {
-                adapter.setPowered(false, null, null);
-            };
-            chatServiceHandler.unregister();
             self.done();
         };
         assert_type(handler.onconnect, "function", "onconnect in BluetoothServiceHandler has wrong type after attaching function to it");
@@ -116,10 +108,10 @@ this_test.step(function () {
     visibleError = self.step_func(function (e) {
         assert_unreached("setVisible exception:" + e.message);
     });
-
-    adapter.setPowered(true,function(){
+    poweredSuccess = self.step_func(function (e) {
         adapter.setVisible(true, visibleSuccess, visibleError);
-    },onError);
+    });
+    adapter.setPowered(true, poweredSuccess, onError);
 
 });
 
index 589a0b9f137f6ecfac16d1a08fa74986a076a600..8164ac9d955fe380ed3039318cff70965b01dc4f 100644 (file)
@@ -35,15 +35,15 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA MMINA MR
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var adapter = null,t = async_test("BluetoothServiceHandler_unregister", {timeout: 90000}), registerRFCOMMServiceByUUIDSuccess,
     registerRFCOMMServiceByUUIDError, powerOnSuccess, powerOnError, retValue = null;
 t.step(function () {
 
     registerRFCOMMServiceByUUIDSuccess = t.step_func(function (recordHandler) {
+        setBluetoothHandlerCleanup(recordHandler);
         retValue = recordHandler.unregister();
 
         assert_equals(retValue, undefined, "unregister returns wrong value");
index 6c017e9f365d01edf015af2ad4f5cdbfc63ea6f6..091c31bb87e4587c209665a5da785a6061971328 100644 (file)
@@ -38,7 +38,7 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MC
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var adapter = null, t = async_test("BluetoothServiceHandler_unregister_errorCallback_TypeMismatch", {timeout: 90000}),
     exceptionName, errorCallback, i,
@@ -51,6 +51,7 @@ t.step(function () {
     });
 
     registerSuccessCB = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
         for(i = 0; i < conversionTable.length; i++) {
             errorCallback = conversionTable[i][0];
             exceptionName = conversionTable[i][1];
@@ -60,7 +61,7 @@ t.step(function () {
                     handler.unregister(successCallback, errorCallback);
                 }, exceptionName + " should be thrown - given incorrect errorCallback.");
         }
-        handler.unregister();
+
         t.done();
     });
 
index 299d31020d0d52b99fd59f7394f2daa259b80bf8..d0f416eb04291da04ce4bba4d78f53330744895d 100644 (file)
@@ -38,7 +38,7 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MTCB
-setup({timeout: 90000});
+setup({timeout: 90000, explicit_done:true});
 
 var t = async_test("BluetoothServiceHandler_unregister_errorCallback_invalid_cb", {timeout: 90000});
 t.step(function () {
@@ -56,11 +56,12 @@ t.step(function () {
     });
 
     registerSuccessCB = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
         assert_throws({name : exceptionName},
             function () {
             handler.unregister(unregisterSuccess, incorrectCallback);
         },exceptionName + " should be thrown - given incorrect error callback.");
-        handler.unregister();
+
         t.done();
     });
 
index 3bb3a8b76b83eade31131af63ef4c1ae97178f58..aa47160ae4d5c60a12211e8d055d584628c624f1 100644 (file)
@@ -46,16 +46,17 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA ME
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter = null, t = async_test("BluetoothServiceHandler_unregister_exist", {timeout:90000}),
     registerRFCOMMServiceByUUIDSuccess, registerRFCOMMServiceByUUIDError, powerOnSuccess, powerOnError;
 t.step(function () {
-    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (recordHandler) {
-        assert_true("unregister" in recordHandler, "unregister in registerRFCOMMServiceByUUIDSuccess");
-        check_method_exists(recordHandler, "unregister");
-        recordHandler.unregister();
+
+    registerRFCOMMServiceByUUIDSuccess = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        assert_true("unregister" in handler, "unregister in registerRFCOMMServiceByUUIDSuccess");
+        check_method_exists(handler, "unregister");
+
         t.done();
     });
 
index 0099db94ec66db14d4860cde2a0195a1a2a03f5d..067aea6288b990a151b2a7778e5a3a66ba6ceb51 100644 (file)
@@ -38,7 +38,7 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MC
-setup({timeout: 90000});
+setup({timeout:90000, explicit_done:true});
 
 var adapter = null, t = async_test("BluetoothServiceHandler_unregister_successCallback_TypeMismatch", {timeout: 90000}), exceptionName, i,
     conversionTable, errorCallback, registerSuccessCB, registerErrorCB, powerOnSuccess, powerOnError, successCallback;
@@ -50,6 +50,7 @@ t.step(function () {
     });
 
     registerSuccessCB = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
         for(i = 0; i < conversionTable.length; i++) {
             successCallback = conversionTable[i][0];
             exceptionName = conversionTable[i][1];
@@ -59,7 +60,7 @@ t.step(function () {
                     handler.unregister(successCallback, errorCallback);
                 }, exceptionName + " should be thrown - given incorrect successCallback.");
         }
-        handler.unregister();
+
         t.done();
     });
 
index fee1ceaf2baa39292a09a45727d16c01457967a7..2a3dc2ff832dcd46a383d8207f56c5ac82b769c4 100644 (file)
@@ -38,7 +38,7 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA MTCB
-setup({timeout: 90000});
+setup({timeout:90000, explicit_done:true});
 
 var t = async_test("BluetoothServiceHandler_unregister_successCallback_invalid_cb", {timeout: 90000});
 t.step(function () {
@@ -56,11 +56,12 @@ t.step(function () {
     });
 
     registerSuccessCB = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
         assert_throws({name : exceptionName},
             function () {
             handler.unregister(incorrectCallback, unregisterError);
         },exceptionName + " should be thrown - given incorrect success callback.");
-        handler.unregister();
+
         t.done();
     });
 
index b39c2dcf9dc0d78d3cbf9ae9949060e15f6124d8..ec6ac7fdcfe61f869aff007caa98747717a56736 100644 (file)
@@ -44,12 +44,11 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA MOA
 setup({timeout: 90000});
 
-var adapter = null, t = async_test("BluetoothServiceHandler_unregister_unregisterServiceRecord", {timeout: 90000}), unregisterSuccess, unregisterError,
-    chatServiceSuccessCallback, powerOnSuccess, powerOnError, chatServiceErrorCallback;
+var adapter = null, t = async_test("BluetoothServiceHandler_unregister_unregisterServiceRecord", {timeout: 90000}), unregisterSuccess,
+    unregisterError, chatServiceSuccessCallback, powerOnSuccess, powerOnError, chatServiceErrorCallback;
 t.step(function () {
     unregisterSuccess = t.step_func(function () {
         t.done();
index 8c4e9a6b8378bc62e4e1e9145e0dfc97b69a2ad2..e5e41609ad9ef3cec014ef9aa5a8dec5afaf1ede 100644 (file)
@@ -45,7 +45,6 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA MOA
 setup({timeout: 90000});
 
index 55a2344436d884a6a58ead380fe076021af20df5..991ce0891de9642162c06c4be43155f7a4a75587 100644 (file)
@@ -36,7 +36,6 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:unregister M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA MOA
 setup({timeout: 90000});
 
index 7f8676702b4932f1e60df395d85c7c9493466db6..68434f8f1606035bfaa7f1ad443ba9429bcbaec0 100644 (file)
@@ -45,18 +45,18 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceHandler:uuid A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
-//==== PRE Tests should be run separately
 //==== TEST_CRITERIA AE AT ARO
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var t = async_test("BluetoothServiceHandler_uuid_attribute", {timeout:90000});
 t.step(function () {
     var adapter, powerOnSuccess, powerOnError, chatServiceSuccessCallback, chatServiceErrorCallback,
         uuid;
 
-    chatServiceSuccessCallback = t.step_func(function (recordHandler) {
-        uuid = recordHandler.uuid;
-        check_readonly(recordHandler, "uuid", uuid, "string", "1234");
-        recordHandler.unregister();
+    chatServiceSuccessCallback = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        uuid = handler.uuid;
+        check_readonly(handler, "uuid", uuid, "string", "1234");
+
         t.done();
     });
 
index fc73ae0648959d34816710e6c16fd82e1c5d418a..dd0cdae12c5a4fa64a943ce75f9638934c5c59ad 100644 (file)
@@ -37,19 +37,20 @@ Authors:
 //==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothServiceSuccessCallback:onsuccess M
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
 //==== TEST_CRITERIA CBT CBOA
-setup({timeout:90000});
+setup({timeout:90000, explicit_done:true});
 var adapter = null,t = async_test("BluetoothServiceSuccessCallback_onsuccess", {timeout:90000}),
     chatServiceSuccessCB, chatServiceErrorCB, powerOnSuccess, powerOnError;
 
 t.step(function () {
 
-    chatServiceSuccessCB = t.step_func(function (recordHandler) {
-        assert_true("uuid" in recordHandler, "No uuid in socket");
-        assert_true("name" in recordHandler, "No name in socket");
-        assert_true("isConnected" in recordHandler, "No isConnected in socket");
-        assert_true("onconnect" in recordHandler, "No onconnect in socket");
-        assert_type(recordHandler.unregister, "function", "Method unregister does not exist.");
-        recordHandler.unregister();
+    chatServiceSuccessCB = t.step_func(function (handler) {
+        setBluetoothHandlerCleanup(handler);
+        assert_true("uuid" in handler, "No uuid in socket");
+        assert_true("name" in handler, "No name in socket");
+        assert_true("isConnected" in handler, "No isConnected in socket");
+        assert_true("onconnect" in handler, "No onconnect in socket");
+        assert_type(handler.unregister, "function", "Method unregister does not exist.");
+
         t.done();
     });
 
index 1fa3ad67f35dab739110d23def7cec1674bceaba..a5329816321c8b45936c0a048d8a8360db193924 100644 (file)
@@ -46,6 +46,28 @@ var INVALID_BLUETOOTH_ADDRESS = [
     null, undefined, 0, 1, "tizen", [1, 2, 3], {}, "35:00:00:00:03"
 ];
 
+function setBluetoothCleanup(obj, method) {
+     add_result_callback(function (res) {
+        if(obj && obj[method] && typeof obj[method] == "function") {
+            try {
+                obj[method](done,done);
+            } catch(e) {
+                done();
+            }
+        } else {
+            done();
+        }
+    });
+}
+
+function setBluetoothHandlerCleanup(handler) {
+    setBluetoothCleanup(handler, "unregister");
+}
+
+function setBluetoothDiscoveryCleanup(adapter) {
+    setBluetoothCleanup(adapter, "stopDiscovery");
+}
+
 function check_bluetooth_device(device) {
     check_readonly(device, "name", device.name, "string", "new_name");
     check_readonly(device, "address", device.address, "string", "new_address");
@@ -80,6 +102,10 @@ function check_bluetooth_device(device) {
     assert_type(device.connectToServiceByUUID, "function", "Method connectToServiceByUUID does not exist.");
 }
 
+function check_bluetooth_device_array(devices) {
+    assert_type(devices, "array", "Devices has wrong type.");
+    assert_greater_than(devices.length, 0, "Bluetooth devices not found.");
+}
 
 function onloaded() {
     try {
index 6f27efc2998b65eedb2fd8e30612da944b786ef7..17e1975cbae6f1ad3136ad66f1028fd53f45cd27 100644 (file)
@@ -57,7 +57,6 @@
       </testcase>
       <testcase purpose="check if unregister method exists" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_unregister_exist">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_exist.html</test_script_entry>
         </description>
       </testcase>
@@ -85,7 +84,6 @@
       </testcase>
       <testcase purpose="check if error callback of registerRFCOMMServiceByUUID method invoked" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothAdapter_registerRFCOMMServiceByUUID_onerror">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_registerRFCOMMServiceByUUID_onerror.html</test_script_entry>
         </description>
       </testcase>
       </testcase>
       <testcase purpose="Check with optional arguments unregister(valid_successCallback, valid_errorCallback)" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_unregister_with_errorCallback">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_with_errorCallback.html</test_script_entry>
         </description>
       </testcase>
       </testcase>
       <testcase purpose="check attribute uuid in BluetoothServiceHandler" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_uuid_attribute">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_uuid_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="check attribute name in BluetoothServiceHandler" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_name_attribute">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_name_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="check attribute isConnected in BluetoothServiceHandler" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_isConnected_attribute">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_isConnected_attribute.html</test_script_entry>
         </description>
       </testcase>
       </testcase>
       <testcase purpose="check using unregister method which is in BluetoothServiceHandler interface to unregister service record" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_unregister_unregisterServiceRecord">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_unregisterServiceRecord.html</test_script_entry>
         </description>
       </testcase>
       </testcase>
       <testcase purpose="Check with optional arguments unregister(valid_successCallback)" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_unregister_with_successCallback">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister_with_successCallback.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="Check with non-optional arguments unregister()" onload_delay="90" component="TizenAPI/Communication/Bluetooth" execution_type="auto" id="BluetoothServiceHandler_unregister">
         <description>
-          <pre_condition>Tests should be run separately</pre_condition>
           <test_script_entry>/opt/tct-bluetooth-tizen-tests/bluetooth/BluetoothServiceHandler_unregister.html</test_script_entry>
         </description>
       </testcase>