[Bluetooth] stopDiscovery before starting discoverDevices
authorWitold Choinkowski <w.choinkowsk@samsung.com>
Mon, 16 Sep 2013 14:00:03 +0000 (16:00 +0200)
committerWitold Choinkowski <w.choinkowsk@samsung.com>
Mon, 16 Sep 2013 14:57:30 +0000 (16:57 +0200)
Change-Id: Id70f6488294a935745a7c8fcd9f09d2210998b52

33 files changed:
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_createBonding_bondingDevice.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices.html
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_discoverDevices_errorCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_errorCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_invalid_callback_name.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_missarg.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_onfinish_successful.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_onfound_deviceaddress.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_onfound_devicename.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_onfound_successful.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_successCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_successCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_discoverDevices_with_errorCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_getKnownDevices.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_getKnownDevices_check_types.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_getKnownDevices_with_errorCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_callback_onerror.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_errorCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_errorCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_successCallback_TypeMismatch.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_successCallback_invalid_cb.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_with_errorCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothAdapter_stopDiscovery_with_successCallback.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothDeviceArraySuccessCallback_onsuccess.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothDiscoverDevicesSuccessCallback_ondevicefound.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothDiscoverDevicesSuccessCallback_onfinished.html
tct-bluetooth-tizen-tests/bluetooth/BluetoothDiscoverDevicesSuccessCallback_onstarted.html
tct-bluetooth-tizen-tests/bluetooth/Bluetooth_discoverDevices_successCallback_invalidcb.html
tct-bluetooth-tizen-tests/bluetooth/support/bluetooth_common.js

index 2bbc16ee9f2b932846685a17ae684ff58abcb58d..d5a864c75263bc75ac355a6e4a12fabaef618e92 100644 (file)
@@ -50,7 +50,7 @@ setup({timeout:90000});
 //  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 = {
@@ -85,16 +85,12 @@ t.step(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();
-    adapter.setPowered(true, powerOnSuccess, powerOnError);
+    stopDiscovery(t, adapter, stopDiscoverySuccess);
 });
 </script>
 </body>
index 88fe93e81c264a09cd4abbc1eff200c67c63d2a3..d2c2265c7a4e0fedae76133d0fd1b4c107b252ee 100644 (file)
@@ -39,8 +39,7 @@ Authors:
 //==== 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 () {
@@ -59,16 +58,12 @@ t.step(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>
index 8166ca32f0583f0a8ff3da7cf747865be08d6e7d..b3b6757d2d37cf1c4ef2db97e7288b0223c945fb 100644 (file)
@@ -37,8 +37,8 @@ Authors:
 //==== 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 () {
@@ -59,16 +59,12 @@ t.step(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>
index 01b582a037e7513a6b286af08962a9720ae6f359..3541ea5955ba118a60e5c2b3620d4686e301586e 100644 (file)
@@ -49,7 +49,7 @@ Authors:
 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 () {
@@ -67,13 +67,13 @@ t.step(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>
index 349a4d4fb5071c8a11827648fdfd66cc828e60fb..787f326e2716ac4102f57a916115712e63edcf81 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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);
 
@@ -49,7 +49,7 @@ t.step(function () {
         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];
@@ -62,12 +62,8 @@ t.step(function () {
         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>
index 1cc08e36818689583f2a5ca415ba7c8f6329a212..347782cc8f18cb12f2ef32a165bd029c9c35f1c0 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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.");
@@ -53,7 +53,7 @@ t.step(function () {
         })
     };
 
-    powerOnSuccess = t.step_func(function () {
+    stopDiscoverySuccess = t.step_func(function () {
         assert_throws({name : exceptionName},
             function () {
             adapter.discoverDevices(successCallback, incorrectCallback);
@@ -61,12 +61,8 @@ t.step(function () {
         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>
index de0dbc056b96155a6cd5e56ea7cfec73a86693ec..41c0cf194a6a98826cc4293706ba68efada1e4c0 100644 (file)
@@ -43,8 +43,8 @@ Authors:
 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();
@@ -57,7 +57,7 @@ t.step(function () {
         onfinished : t.step_func(function () {})
     };
 
-    setPoweredSuccessCB = t.step_func(function () {
+    stopDiscoverySuccess = t.step_func(function () {
         try {
             adapter.discoverDevices(discoverDevicesSuccessCallback);
             adapter.stopDiscovery(stopDiscoverySuccessCB);
@@ -66,11 +66,7 @@ t.step(function () {
         }
     });
 
-    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>
index 56b626ba41df950e5a7475f9537c001e6866dcab..02631c5e522bbd829bc64c1b786ffa24fd519374 100644 (file)
@@ -40,9 +40,9 @@ Authors:
 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();
@@ -50,12 +50,8 @@ t.step(function () {
         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>
index a6f0349f2dbd448797a8679d6dfec67c9ad1168c..120c46cdc1da09c8f000b11694c9a5ab66a397cc 100644 (file)
@@ -52,7 +52,7 @@ setup({timeout:90000});
 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 () {
@@ -70,16 +70,12 @@ t.step(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>
index 5a23d22d447bcd41ab07344e8923a44de3c8dc0f..c05dd60ba97652bedfe2bafdf6b03d3f075ecced 100644 (file)
@@ -52,7 +52,7 @@ Authors:
 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 () {
@@ -74,17 +74,13 @@ t.step(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>
index 831e0607830b1514e6498a9d36f301382f769201..85bb4a02b18261cccfdd8d2a9a563fca8e852a5f 100644 (file)
@@ -51,7 +51,7 @@ Authors:
 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 () {
@@ -73,17 +73,13 @@ t.step(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>
index 702254af102fb5676a02d6d581544f50e1bfa0f0..16f3fa5affec75098c70d5540a380913f49ec8ad 100644 (file)
@@ -52,7 +52,7 @@ Authors:
 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 () {
@@ -74,17 +74,13 @@ t.step(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>
index 96268949a712c02f36e6308c03fd8b6d324e0c8e..5c5ec12c95f2cbf44b60049ce05d8c1327d248be 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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);
 
@@ -49,7 +49,7 @@ t.step(function () {
         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];
@@ -62,12 +62,8 @@ t.step(function () {
         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>
index 8135f113efa4fe3ab9521edb117ecd2c14557dc2..f5297a2ee94695612aa7445deaa416bc52d7a7cf 100644 (file)
@@ -40,8 +40,8 @@ Authors:
 //==== 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"]);
 
@@ -49,7 +49,7 @@ t.step(function () {
         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];
@@ -61,12 +61,8 @@ t.step(function () {
         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>
index e2073bf0ffa5359f0ba87b5f29600fbf93fcf5b5..068ed1ad82bf155ed436d347f1a6b27b68ef7329 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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 () {
         }),
@@ -62,16 +62,12 @@ 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>
index ad98acebdb85feabcb9a6ca1e76654b48f3270d6..831f9e685784b91bf3b1c664e46f53fafc272c38 100644 (file)
@@ -42,7 +42,7 @@ Authors:
 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);
@@ -70,16 +70,12 @@ t.step(function () {
     });
 
 
-    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>
index bdd27b9d0d8d02faa664adfa0dca6e70627d4cd8..094629faae745e255df9939c0f341590c2736f19 100644 (file)
@@ -43,7 +43,7 @@ Authors:
 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:");
@@ -83,20 +83,12 @@ t.step(function () {
         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>
index 233e5cb2d74e3f906af408bdfb53be0944eb32fb..0703e0adc178a0f1cbe425a69813b406e19a7212 100644 (file)
@@ -41,8 +41,7 @@ Authors:
 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);
@@ -73,16 +72,12 @@ t.step(function () {
         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>
index 6ca8c9e588e1421c3a87b0054791a52a9eefadb4..21bb23df89f44bd700bb87ac52c7b2b9ff05f59f 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 //==== 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 = {
@@ -62,17 +62,13 @@ t.step(function () {
         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>
index 70ae2c48a75c6a51b8d4bdf7161d86a848aafea3..607ceab12fddb676952a142c4195e1f2a68963d6 100644 (file)
@@ -40,8 +40,8 @@ Authors:
 //==== 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");
@@ -52,16 +52,12 @@ t.step(function () {
     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>
index a57c5b006dad4a4f9f510cc79509d49f8e183eee..fd950173f6faa5386178e0b05ff1bccfa82c38ea 100644 (file)
@@ -40,7 +40,7 @@ Authors:
 //==== 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);
 
@@ -56,9 +56,9 @@ t.step(function () {
         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];
@@ -70,23 +70,19 @@ t.step(function () {
                 }
                 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>
index dc3d258e387b7b769b4be43d2e3188d9aacea44a..cddccdf2179a337b641024683327e1672ba1422c 100644 (file)
@@ -40,7 +40,7 @@ Authors:
 //==== 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 = {
@@ -61,32 +61,28 @@ t.step(function () {
         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>
index 1a0587175921ac4b37c7598ac2ad072c5533b300..e908074aa8e723340064473af2c1135d3f9e06cd 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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);
 
@@ -57,9 +57,9 @@ t.step(function () {
         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];
@@ -71,23 +71,19 @@ t.step(function () {
                 }
                 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>
index b31a1fc7103a5de4da31ff32edb9f897d592319c..85ed40c502fa08f8a244c4fe27facf1a88998944 100644 (file)
@@ -31,7 +31,7 @@ Authors:
 <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
@@ -41,7 +41,7 @@ setup({timeout:90000});
 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 () {
@@ -61,31 +61,27 @@ t.step(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>
index 3f714c5112cd2543df027bc80bc43a9307315662..8fa566380e641bc643fd27e3d7f60e5318642894 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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;
 
@@ -69,16 +69,12 @@ t.step(function () {
         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);
 
 });
 
index 6632eefce450e06a5ed8cfdbc66f599f74e50926..cff0be4a1f03117df9bb9d39b080ab4406b843d4 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 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;
 
@@ -65,16 +65,12 @@ t.step(function () {
         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>
index 28e0c2bbb8833876365462e34d4945da2ebc57da..8d3005959e08f080e778c71538ff373d7ef622ba 100644 (file)
@@ -39,7 +39,7 @@ Authors:
 //==== 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) {
@@ -71,16 +71,12 @@ t.step(function () {
         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>
index 9b02ef88b2742e47f63a6af22ffb1574c540a41b..70e174f27f47b23f0c9507acd1b41a766a86c91f 100644 (file)
@@ -42,7 +42,7 @@ Authors:
 //==== 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 () {
 
@@ -58,7 +58,6 @@ 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");
@@ -76,7 +75,7 @@ t.step(function () {
         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 {
@@ -85,16 +84,12 @@ t.step(function () {
         })
     };
 
-    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>
index b5e4d639d7ac7eb0b28bfbf45be4c9ef582569f8..26895a6396a3b62effc240a6a8963dfeb58e975b 100644 (file)
@@ -42,7 +42,7 @@ Authors:
 
 setup({timeout:90000, explicit_done:true});
 var adapter = null, t = async_test("BluetoothDiscoverDevicesSuccessCallback_ondevicefound", {timeout:90000}),
-    powerOnError, powerOnSuccess, discoverDevicesErrorCB;
+    stopDiscoverySuccess, discoverDevicesErrorCB;
 
 t.step(function () {
 
@@ -66,17 +66,13 @@ 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>
index 5d7e1e3f1a9eed3be13b0ecb415d054466d6e144..9f386c773364339dec101899561331d6ee4d7543 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 //==== 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 () {
 
@@ -65,16 +65,12 @@ 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>
index 3b531c96f170578c853f68011f1d03e10ebb0dd7..bcfa2beef945f39ec14963e07a0dba081520a41f 100644 (file)
@@ -39,7 +39,7 @@ Authors:
 //==== 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 () {
 
@@ -63,16 +63,12 @@ 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>
index cbe3b2f0dd7068759dadfa6c11e70051637cfb9a..24e5b37a9bcbfb6d4dd4f2afd98580f76a11660d 100644 (file)
@@ -40,7 +40,7 @@ Authors:
 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 () {
 
@@ -48,7 +48,7 @@ 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];
@@ -61,12 +61,8 @@ t.step(function () {
         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>
index a5329816321c8b45936c0a048d8a8360db193924..85c7fa2930be2308b8b98e6f8a4144f5b473c12e 100644 (file)
@@ -46,6 +46,25 @@ var INVALID_BLUETOOTH_ADDRESS = [
     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") {