// setPowered, setVisible, discoverDevices, createBonding, destroyBonding methods in BluetoothAdapter interface usage test
var adapter = null, t = async_test("BluetoothAdapter_createBonding_bondingDevice", {timeout:90000}),
destroyBondingSuccess, destroyBondingError, onBondingSuccess, onBondingError, discoverDevicesError,
- powerOnSuccess, powerOnError;
+ stopDiscoverySuccess;
t.step(function () {
var discoverDevicesSuccessCallback = {
assert_unreached("discoverDevicesError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCallback, discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== PRE The bluetooth of the remote device MUST be turned on and discoverable from other devices.
//==== TEST_CRITERIA MMINA MAST MR
setup({timeout:90000});
-var adapter = null, t = async_test("BluetoothAdapter_discoverDevices",{ timeout:90000 }), powerOnSuccess,
- powerOnError, retValue = null;
+var adapter = null, t = async_test("BluetoothAdapter_discoverDevices",{ timeout:90000 }), stopDiscoverySuccess, retValue = null;
t.step(function () {
var discoverDevicesSuccessCB = {
onstarted: t.step_func(function () {
})
};
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
retValue = adapter.discoverDevices(discoverDevicesSuccessCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html
//==== TEST_CRITERIA MERRCB
setup({timeout:90000});
-var adapter = null, t = async_test("BluetoothAdapter_discoverDevices_callback_onerror",{ timeout:90000 }), powerOffSuccess,
- powerOffError,discoverDevicesSuccessCB, errorCallback;
+var adapter = null, t = async_test("BluetoothAdapter_discoverDevices_callback_onerror",{ timeout:90000 }), stopDiscoverySuccess,
+ discoverDevicesSuccessCB, errorCallback;
t.step(function () {
discoverDevicesSuccessCB = {
onstarted: t.step_func(function () {
t.done();
});
- powerOffSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB,errorCallback);
});
- powerOffError = t.step_func(function (e) {
- assert_unreached("powerOffError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(false, powerOffSuccess, powerOffError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000, explicit_done:true});
var t = async_test("BluetoothAdapter_discoverDevices_callback_successful",{timeout: 90000});
t.step(function () {
- var adapter, discoverDevicesErrorCallback, startDiscoveryDevice, discoverDevicesSuccessCallback;
+ var adapter, discoverDevicesErrorCallback, stopDiscoverySuccess, discoverDevicesSuccessCallback;
discoverDevicesSuccessCallback = {
onstarted: t.step_func(function () {
assert_unreached("discoverDevicesErrorCallback" + e.message);
});
- startDiscoveryDevice = t.step_func(function (){
+ stopDiscoverySuccess = t.step_func(function (){
adapter.discoverDevices(discoverDevicesSuccessCallback,discoverDevicesErrorCallback);
});
adapter = tizen.bluetooth.getDefaultAdapter();
setBluetoothDiscoveryCleanup(adapter);
- adapter.setPowered(true, startDiscoveryDevice);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000});
var adapter = null, t = async_test("BluetoothAdapter_discoverDevices_errorCallback_TypeMismatch", {timeout: 90000}), exceptionName, i,
- successCallback, errorCallback, powerOnSuccess, powerOnError, conversionTable;
+ successCallback, errorCallback, stopDiscoverySuccess, conversionTable;
t.step(function () {
conversionTable = getTypeConversionExceptions("functionObject", true);
assert_unreached("errorCallback exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
for(i = 0; i < conversionTable.length; i++) {
errorCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
t.done();
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000});
var adapter = null,t = async_test("BluetoothAdapter_discoverDevices_errorCallback_invalid_cb", {timeout: 90000}),exceptionName = "TypeMismatchError",
- successCallback, incorrectCallback, powerOnSuccess, powerOnError;
+ successCallback, incorrectCallback, stopDiscoverySuccess;
t.step(function () {
successCallback =t.step_func( function () {
assert_unreached("Should not be here.");
})
};
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
assert_throws({name : exceptionName},
function () {
adapter.discoverDevices(successCallback, incorrectCallback);
t.done();
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000});
var t = async_test("BluetoothAdapter_discoverDevices_invalid_callback_name",{timeout:90000});
t.step(function () {
- var adapter = tizen.bluetooth.getDefaultAdapter(), setPoweredSuccessCB, setPoweredErrorCB,
- discoverDevicesSuccessCallback, stopDiscoverySuccessCB;
+ var adapter = tizen.bluetooth.getDefaultAdapter(),
+ discoverDevicesSuccessCallback, stopDiscoverySuccessCB, stopDiscoverySuccess;
stopDiscoverySuccessCB = t.step_func(function () {
t.done();
onfinished : t.step_func(function () {})
};
- setPoweredSuccessCB = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
try {
adapter.discoverDevices(discoverDevicesSuccessCallback);
adapter.stopDiscovery(stopDiscoverySuccessCB);
}
});
- setPoweredErrorCB = t.step_func(function (e) {
- assert_unreached("setPoweredErrorCB exception:" + e.message);
- });
-
- adapter.setPowered(true, setPoweredSuccessCB, setPoweredErrorCB);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
}, "BluetoothAdapter_discoverDevices_invalid_callback_name");
</script>
setup({timeout:90000});
var t = async_test("BluetoothAdapter_discoverDevices_missarg", {timeout: 90000});
t.step(function () {
- var adapter, powerOnSuccess, powerOnError;
+ var adapter, stopDiscoverySuccess;
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
assert_throws ({name:"TypeMismatchError"},
function () {
adapter.discoverDevices();
t.done();
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
var t = async_test("BluetoothAdapter_discoverDevices_onfinish_successful", {timeout: 90000});
t.step(function () {
- var adapter, powerOnSuccess, powerOnError, discoverDevicesSuccessCallback, discoverDevicesErrorCB;
+ var adapter, stopDiscoverySuccess, discoverDevicesSuccessCallback, discoverDevicesErrorCB;
discoverDevicesSuccessCallback = {
onstarted : t.step_func(function () {
assert_unreached("discoverDevicesErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCallback, discoverDevicesErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000, explicit_done:true});
var t = async_test("BluetoothAdapter_discoverDevices_onfound_deviceaddress",{timeout:90000});
t.step(function () {
- var adapter, discoverDevicesError, powerOnSuccess, powerOnError, discoverDevicesSuccessCallback;
+ var adapter, discoverDevicesError, stopDiscoverySuccess, discoverDevicesSuccessCallback;
discoverDevicesSuccessCallback = {
onstarted: t.step_func(function () {
assert_unreached("discoverDevicesError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCallback, discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
setBluetoothDiscoveryCleanup(adapter);
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000, explicit_done:true});
var t = async_test("BluetoothAdapter_discoverDevices_onfound_devicename",{timeout:90000});
t.step(function () {
- var adapter, discoverDevicesError, powerOnSuccess, powerOnError, discoverDevicesSuccessCallback;
+ var adapter, discoverDevicesError, stopDiscoverySuccess, discoverDevicesSuccessCallback;
discoverDevicesSuccessCallback = {
onstarted: t.step_func(function () {
assert_unreached("discoverDevicesError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCallback, discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
setBluetoothDiscoveryCleanup(adapter);
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000, explicit_done:true});
var t = async_test("BluetoothAdapter_discoverDevices_onfound_successful",{timeout:90000});
t.step(function () {
- var adapter, powerOnSuccess, powerOnError, discoverDevicesSuccessCallback, discoverDevicesError;
+ var adapter, stopDiscoverySuccess, discoverDevicesSuccessCallback, discoverDevicesError;
discoverDevicesSuccessCallback = {
onstarted: t.step_func(function () {
assert_unreached("discoverDevicesError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCallback, discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
setBluetoothDiscoveryCleanup(adapter);
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000});
var adapter = null, t = async_test("BluetoothAdapter_discoverDevices_successCallback_TypeMismatch", {timeout: 90000}), exceptionName, i,
- conversionTable, errorCallback, powerOnSuccess, powerOnError, successCallback;
+ conversionTable, errorCallback, stopDiscoverySuccess, successCallback;
t.step(function () {
conversionTable = getTypeConversionExceptions("object", false);
assert_unreached("errorCallback exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
for(i = 0; i < conversionTable.length; i++) {
successCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
t.done();
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== TEST_CRITERIA MTCB
setup({timeout: 90000});
-var adapter = null,t = async_test("BluetoothAdapter_discoverDevices_successCallback_invalid_cb", {timeout: 90000}),exceptionName = "TypeMismatchError",incorrectListeners,
- incorrectCallback, i, powerOnError, powerOnSuccess, discoverDevicesError;
+var adapter = null,t = async_test("BluetoothAdapter_discoverDevices_successCallback_invalid_cb", {timeout: 90000}),
+ incorrectCallback, i, stopDiscoverySuccess, discoverDevicesError, exceptionName = "TypeMismatchError",incorrectListeners;
t.step(function () {
incorrectListeners = getListenerConversionExceptions(["onstarted", "ondevicefound", "ondevicedisappeared", "onfinished"]);
assert_unreached("discoverDevicesError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
for(i = 0; i < incorrectListeners.length; i++) {
incorrectCallback = incorrectListeners[i][0];
exceptionName = incorrectListeners[i][1];
t.done();
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000});
var t = async_test("BluetoothAdapter_discoverDevices_with_errorCallback",{ timeout:90000 });
t.step(function () {
- var adapter, discoverDevicesErrorCB, powerOnSuccess, powerOnError, discoverDevicesSuccessCB;
+ var adapter, discoverDevicesErrorCB, stopDiscoverySuccess, discoverDevicesSuccessCB;
discoverDevicesSuccessCB = {
onstarted: t.step_func(function () {
}),
assert_unreached("discoverDevicesErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB, discoverDevicesErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000});
var t = async_test("BluetoothAdapter_getKnownDevices",{ timeout: 90000 });
t.step(function () {
- var adapter, testDeviceSuccessCB, discoverSuccess, discoverError, powerOnSuccess, powerOnError, retValue = null;
+ var adapter, testDeviceSuccessCB, discoverSuccess, discoverError, stopDiscoverySuccess, retValue = null;
testDeviceSuccessCB = t.step_func(function (devices) {
check_bluetooth_device_array(devices);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverSuccess, discoverError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000});
var t = async_test("BluetoothAdapter_getKnownDevices_check_types", {timeout:90000});
t.step(function () {
- var adapter, powerOnSuccess, powerOnError, discoverSuccess, discoverError, i, testDeviceSuccessCB, testMultipleDevicesSuccessCB;
+ var adapter, stopDiscoverySuccess, discoverSuccess, discoverError, i, testDeviceSuccessCB, testMultipleDevicesSuccessCB;
testDeviceSuccessCB = t.step_func(function (device) {
assert_type(device.name, "string", "Device name type check:");
assert_unreached("discoverError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverSuccess, discoverError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- if(!adapter.powered){
- adapter.setPowered(true, powerOnSuccess, powerOnError);
- }else{
- adapter.discoverDevices(discoverSuccess, discoverError);
- }
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
setup({timeout:90000});
var t = async_test("BluetoothAdapter_getKnownDevices_with_errorCallback",{ timeout: 90000});
t.step(function () {
- var adapter, getKnownDevicesErrorCB, testDeviceSuccessCB, testMultipleDevicesSuccessCB, discoverSuccess, discoverError, powerOnSuccess,
- powerOnError;
+ var adapter, getKnownDevicesErrorCB, testDeviceSuccessCB, testMultipleDevicesSuccessCB, discoverSuccess, discoverError, stopDiscoverySuccess;
getKnownDevicesErrorCB = t.step_func(function (e) {
assert_unreached("onError exception:" + e.message);
assert_unreached("discoverError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverSuccess, discoverError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== TEST_CRITERIA MMINA MR
setup({timeout:90000, explicit_done:true});
var adapter, t = async_test("BluetoothAdapter_stopDiscovery", {timeout: 90000}), discoverDevicesSuccessCB,
- testBluetoothErrorCB, powerOnSuccess, powerOnError, retValue = null;
+ testBluetoothErrorCB, stopDiscoverySuccess, retValue = null;
t.step(function () {
discoverDevicesSuccessCB = {
assert_unreached("testBluetoothErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB, testBluetoothErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
setBluetoothDiscoveryCleanup(adapter);
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html#discoverDevicesid2316511
//==== TEST_CRITERIA MERRCB
setup({timeout:90000});
-var adapter, t = async_test("BluetoothAdapter_stopDiscovery_callback_onerror", {timeout: 90000}), powerOffSuccess,
- powerOffError, successCallback, errorCallback;
+var adapter, t = async_test("BluetoothAdapter_stopDiscovery_callback_onerror", {timeout: 90000}), stopDiscoverySuccess,
+ successCallback, errorCallback;
t.step(function () {
errorCallback = t.step_func(function (error) {
assert_equals(error.name, "ServiceNotAvailableError", "expected another error");
successCallback = t.step_func(function () {
assert_unreached("invalid successCallback invoked");
});
- powerOffSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.stopDiscovery(successCallback, errorCallback);
});
- powerOffError = t.step_func(function (e) {
- assert_unreached("powerOffError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(false, powerOffSuccess, powerOffError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
//==== TEST_CRITERIA MC
setup({timeout:90000});
var adapter, t = async_test("BluetoothAdapter_stopDiscovery_errorCallback_TypeMismatch", {timeout: 90000}), exceptionName, i,
- conversionTable, successCallback, discoverDevicesError, powerOnSuccess, powerOnError, errorCallback, stopDiscoverySuccessCB;
+ conversionTable, successCallback, discoverDevicesError, stopDiscoverySuccess, errorCallback, stopDiscoverySuccessCB;
t.step(function () {
conversionTable = getTypeConversionExceptions("functionObject", true);
t.done();
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
var discoverDevicesSuccessCallback = {
- onstarted: function() {
+ onstarted: function () {
for(i = 0; i < conversionTable.length; i++) {
errorCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
}
adapter.stopDiscovery(stopDiscoverySuccessCB);
},
- ondevicefound: function(device) {
+ ondevicefound: function (device) {
},
- ondevicedisappeared: function(address) {
+ ondevicedisappeared: function (address) {
},
- onfinished: function(devices) {
+ onfinished: function (devices) {
}
};
adapter.discoverDevices(discoverDevicesSuccessCallback,discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== TEST_CRITERIA MTCB
setup({timeout:90000});
var adapter, t = async_test("BluetoothAdapter_stopDiscovery_errorCallback_invalid_cb", {timeout:90000}),
- exceptionName = "TypeMismatchError",incorrectCallback, powerOnSuccess, powerOnError, discoverDevicesSuccessCallback,
+ exceptionName = "TypeMismatchError",incorrectCallback, stopDiscoverySuccess, discoverDevicesSuccessCallback,
discoverDevicesError, successCallback, discoverDevicesSuccessCallback, stopDiscoverySuccessCB;
t.step(function () {
incorrectCallback = {
assert_unreached("discoverDevices() error callback invoked:name" + e.name + ", msg:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
discoverDevicesSuccessCallback = {
- onstarted: function() {
+ onstarted: function () {
assert_throws({name : exceptionName},
function () {
adapter.stopDiscovery(successCallback, incorrectCallback);
},exceptionName + " should be thrown - given incorrect success callback.");
adapter.stopDiscovery(stopDiscoverySuccessCB);
},
- ondevicefound: function(device) {
+ ondevicefound: function (device) {
},
- ondevicedisappeared: function(address) {
+ ondevicedisappeared: function (address) {
},
- onfinished: function(devices) {
+ onfinished: function (devices) {
}
};
adapter.discoverDevices(discoverDevicesSuccessCallback,discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("setPowered() error callback invoked:name" + e.name + ", msg:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000});
var adapter = null, t = async_test("BluetoothAdapter_stopDiscovery_successCallback_TypeMismatch", {timeout: 90000}), exceptionName, i,
- powerOnError, powerOnSuccess, discoverDevicesError, errorCallback, conversionTable, successCallback, stopDiscoverySuccessCB;
+ stopDiscoverySuccess, discoverDevicesError, errorCallback, conversionTable, successCallback, stopDiscoverySuccessCB;
t.step(function () {
conversionTable = getTypeConversionExceptions("functionObject", true);
assert_unreached("discoverDevicesError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
var discoverDevicesSuccessCallback = {
- onstarted: function() {
+ onstarted: function () {
for(i = 0; i < conversionTable.length; i++) {
successCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
}
adapter.stopDiscovery(stopDiscoverySuccessCB);
},
- ondevicefound: function(device) {
+ ondevicefound: function (device) {
},
- ondevicedisappeared: function(address) {
+ ondevicedisappeared: function (address) {
},
- onfinished: function(devices) {
+ onfinished: function (devices) {
}
};
adapter.discoverDevices(discoverDevicesSuccessCallback,discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
<div id="log"></div>
<script>
//==== TEST: BluetoothAdapter_stopDiscovery_successCallback_invalid_cb
-//==== LABEL Check stopDiscovery argument successCallback validation - use {onsuccess: function(){}}
+//==== LABEL Check stopDiscovery argument successCallback validation - use {onsuccess: function (){}}
//==== PRIORITY P2
//==== ONLOAD_DELAY 90
//==== SPEC Tizen Web API:Communication:Bluetooth:BluetoothAdapter:stopDiscovery M
var t = async_test("BluetoothAdapter_stopDiscovery_successCallback_invalid_cb", {timeout: 90000});
t.step(function () {
var adapter, exceptionName = "TypeMismatchError", incorrectCallback, discoverDevicesError, stopDiscoveryError,
- powerOnSuccess, powerOnError, stopDiscoverySuccessCB;
+ stopDiscoverySuccess, stopDiscoverySuccessCB;
incorrectCallback = {
onsuccess: t.step_func(function () {
assert_unreached("stopDiscoveryError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
var discoverDevicesSuccessCallback = {
- onstarted: function() {
+ onstarted: function () {
assert_throws({name : exceptionName},
function () {
adapter.stopDiscovery(incorrectCallback, stopDiscoveryError);
},exceptionName + " should be thrown - given incorrect success callback.");
adapter.stopDiscovery(stopDiscoverySuccessCB);
},
- ondevicefound: function(device) {
+ ondevicefound: function (device) {
},
- ondevicedisappeared: function(address) {
+ ondevicedisappeared: function (address) {
},
- onfinished: function(devices) {
+ onfinished: function (devices) {
}
};
adapter.discoverDevices(discoverDevicesSuccessCallback,discoverDevicesError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout: 90000});
var adapter, self, t = async_test("BluetoothAdapter_stopDiscovery_with_errorCallback", {timeout: 90000}),
- stopDiscoverySuccessCB, stopDiscoveryErrorCB, discoverDevicesSuccessCB, testBluetoothErrorCB, powerOnSuccess, powerOnError;
+ stopDiscoverySuccessCB, stopDiscoveryErrorCB, discoverDevicesSuccessCB, testBluetoothErrorCB, stopDiscoverySuccess;
t.step(function () {
self = this;
assert_unreached("testBluetoothErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB, testBluetoothErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
setup({timeout: 90000});
var adapter, self, t = async_test("BluetoothAdapter_stopDiscovery_with_successCallback", {timeout: 90000}),
- stopDiscoverySuccessCB, discoverDevicesSuccessCB, testBluetoothErrorCB, powerOnSuccess, powerOnError;
+ stopDiscoverySuccessCB, discoverDevicesSuccessCB, testBluetoothErrorCB, stopDiscoverySuccess;
t.step(function () {
self = this;
assert_unreached("testBluetoothErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB, testBluetoothErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
//==== TEST_CRITERIA CBOA CBT
setup({timeout:90000});
var adapter = null, t = async_test("BluetoothDeviceArraySuccessCallback_onsuccess",{timeout:90000}), i,
- powerOnError, powerOnSuccess, getKnownDeviceserrorCB, getKnownDevicessuccessCB, discoverSuccess, discoverError;
+ stopDiscoverySuccess, getKnownDeviceserrorCB, getKnownDevicessuccessCB, discoverSuccess, discoverError;
t.step(function () {
getKnownDevicessuccessCB = t.step_func(function (devices) {
assert_unreached("discoverError exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverSuccess, discoverError);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== TEST_CRITERIA CBT CBOA
setup({timeout:90000});
var adapter = null,t = async_test("BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared", {timeout:90000}),
- powerOnError, powerOnSuccess, discoverDevicesErrorCB, discoverDevicesSuccessOneCB, discoverDevicesSuccessTwoCB, flag = false;
+ stopDiscoverySuccess, discoverDevicesErrorCB, discoverDevicesSuccessOneCB, discoverDevicesSuccessTwoCB, flag = false;
t.step(function () {
ondevicedisappeared: t.step_func(function (address) {
assert_type(address, "string", "address has wrong type");
flag = true;
- t.done();
}),
onfinished: t.step_func(function (devices) {
assert_true(flag, "Device not dissapeared");
onfinished: t.step_func(function (devices) {
if (devices.length !== 0 ){
alert("Please disable bluetooth on other device");
- setTimeout(function(){
+ setTimeout(function (){
adapter.discoverDevices(discoverDevicesSuccessTwoCB,discoverDevicesErrorCB);
},5000);
} else {
})
};
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessOneCB,discoverDevicesErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000, explicit_done:true});
var adapter = null, t = async_test("BluetoothDiscoverDevicesSuccessCallback_ondevicefound", {timeout:90000}),
- powerOnError, powerOnSuccess, discoverDevicesErrorCB;
+ stopDiscoverySuccess, discoverDevicesErrorCB;
t.step(function () {
assert_unreached("discoverDevicesErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB,discoverDevicesErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
setBluetoothDiscoveryCleanup(adapter);
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== TEST_CRITERIA CBT CBOA
setup({timeout:90000});
var adapter = null,t = async_test("BluetoothDiscoverDevicesSuccessCallback_onfinished", {timeout:90000}),
- powerOnError, powerOnSuccess, discoverDevicesErrorCB, i;
+ stopDiscoverySuccess, discoverDevicesErrorCB, i;
t.step(function () {
assert_unreached("discoverDevicesErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB,discoverDevicesErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
//==== TEST_CRITERIA CBOA
setup({timeout:90000});
var adapter = null,t = async_test("BluetoothDiscoverDevicesSuccessCallback_onstarted", {timeout:90000}),
- powerOnError, powerOnSuccess, discoverDevicesErrorCB, stopDiscoverySuccessCB;
+ stopDiscoverySuccess, discoverDevicesErrorCB, stopDiscoverySuccessCB;
t.step(function () {
assert_unreached("discoverDevicesErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
adapter.discoverDevices(discoverDevicesSuccessCB,discoverDevicesErrorCB);
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
setup({timeout:90000});
var adapter = null, t = async_test("Bluetooth_discoverDevices_successCallback_invalidcb", {timeout:90000}),
exceptionName, incorrectListeners, i,
- powerOnError, powerOnSuccess, discoverDevicesErrorCB, invalidCallback;
+ stopDiscoverySuccess, discoverDevicesErrorCB, invalidCallback;
t.step(function () {
assert_unreached("discoverDevicesErrorCB exception:" + e.message);
});
- powerOnSuccess = t.step_func(function () {
+ stopDiscoverySuccess = t.step_func(function () {
incorrectListeners = getListenerConversionExceptions(["onstarted", "ondevicefound", "ondevicedisappeared", "onfinished"]);
for(i = 0; i < incorrectListeners.length; i++) {
invalidCallback = incorrectListeners[i][0];
t.done();
});
- powerOnError = t.step_func(function (e) {
- assert_unreached("powerOnError exception:" + e.message);
- });
-
adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setPowered(true, powerOnSuccess, powerOnError);
+ stopDiscovery(t, adapter, stopDiscoverySuccess);
});
</script>
</body>
null, undefined, 0, 1, "tizen", [1, 2, 3], {}, "35:00:00:00:03"
];
+function setPowered (t, adapter, powerOnSuccess) {
+ var powerOnError = t.step_func(function (e) {
+ assert_unreached("powerOnError exception:" + e.message);
+ });
+
+ adapter.setPowered(true, powerOnSuccess, powerOnError);
+}
+
+function stopDiscovery (t, adapter, stopDiscoverySuccess) {
+ var stopDiscoveryError = t.step_func(function (e) {
+ assert_unreached("stopDiscoveryError exception:" + e.message);
+ });
+
+ var powerOnSuccess = t.step_func(function () {
+ adapter.stopDiscovery(stopDiscoverySuccess, stopDiscoveryError);
+ });
+ setPowered(t, adapter, powerOnSuccess);
+}
+
function setBluetoothCleanup(obj, method) {
add_result_callback(function (res) {
if(obj && obj[method] && typeof obj[method] == "function") {