};
errorCallback = t.step_func(function (error) {
assert_equals(error.name, "ServiceNotAvailableError", "expected another error");
- adapter.stopDiscovery();
t.done();
});
//==== 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) {
}),
});
adapter = tizen.bluetooth.getDefaultAdapter();
+ setBluetoothDiscoveryCleanup(adapter);
adapter.setPowered(true, startDiscoveryDevice);
});
</script>
//==== 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();
});
//==== 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" +
//==== 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 () {
//==== 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();
});
//==== 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");
//==== 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();
});
//==== 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();
});
//==== 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();
});
//==== 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();
});
//==== 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;
adapter = tizen.bluetooth.getDefaultAdapter();
healthRegisterSuccess = t.step_func(function (registerHealthApp) {
+ setBluetoothHandlerCleanup(registerHealthApp);
retValue = registerHealthApp.unregister();
assert_equals(retValue, undefined, "unregister returns wrong value");
//==== 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;
});
healthRegisterSuccess = t.step_func(function (registerHealthApp) {
+ setBluetoothHandlerCleanup(registerHealthApp);
for(i = 0; i < conversionTable.length; i++) {
argument = conversionTable[i][0];
exceptionName = conversionTable[i][1];
}, exceptionName + " should be thrown - given incorrect argument.");
}
- registerHealthApp.unregister();
-
t.done();
});
//==== 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;
});
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();
});
//==== 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();
});
//==== 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);
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];
}, exceptionName + " should be thrown - given incorrect argument.");
}
- registerHealthApp.unregister();
-
t.done();
});
<head>
<title>BluetoothHealthProfileHandler_registerSinkApplication</title>
<script src="../resources/unitcommon.js"></script>
+<script src="support/bluetooth_common.js"></script>
</head>
<body>
<div id="log"></div>
//==== 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 () {
//==== 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) {
//==== 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();
});
//==== 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});
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();
});
//==== 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});
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();
});
//==== 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) {
});
TestMessage = "registerRFCOMMServiceByUUID";
- add_result_callback(function (res) {
- serviceHandler.unregister();
- });
-
registerSuccessCallback = self.step_func(function (handler) {
- serviceHandler = handler;
+ setBluetoothHandlerCleanup(handler);
sendMsg = "";
chatServiceHandler = handler;
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");
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);
});
//==== 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");
//==== 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,
});
registerSuccessCB = t.step_func(function (handler) {
+ setBluetoothHandlerCleanup(handler);
for(i = 0; i < conversionTable.length; i++) {
errorCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
handler.unregister(successCallback, errorCallback);
}, exceptionName + " should be thrown - given incorrect errorCallback.");
}
- handler.unregister();
+
t.done();
});
//==== 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 () {
});
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();
});
//==== 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();
});
//==== 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;
});
registerSuccessCB = t.step_func(function (handler) {
+ setBluetoothHandlerCleanup(handler);
for(i = 0; i < conversionTable.length; i++) {
successCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
handler.unregister(successCallback, errorCallback);
}, exceptionName + " should be thrown - given incorrect successCallback.");
}
- handler.unregister();
+
t.done();
});
//==== 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 () {
});
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();
});
//==== 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();
//==== 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});
//==== 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});
//==== 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();
});
//==== 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();
});
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");
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 {
</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>
</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>