Improved test cases for exceptional cases
authorJunghyuk Park <junghyuk.park@samsung.com>
Tue, 5 Nov 2013 15:17:26 +0000 (00:17 +0900)
committerJunghyuk Park <junghyuk.park@samsung.com>
Tue, 5 Nov 2013 15:30:55 +0000 (00:30 +0900)
Change-Id: Ieabfe8fadec3b06799fd559bce1dc6cd1f08525e

tests/Alarm/js/main.js [changed mode: 0644->0755]
tests/Bluetooth/js/main.js [changed mode: 0644->0755]
tests/DataSync/index.html
tests/DataSync/js/main.js [changed mode: 0644->0755]
tests/MessagingSMSMMS/js/main.js [changed mode: 0644->0755]
tests/NFC/js/main.js [changed mode: 0644->0755]
tests/Push/index.html
tests/Push/js/main.js [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 782af66..35160d2
@@ -65,7 +65,7 @@ function fileURI() {
     function onsuccess(files) {
         for (var i = 0; i < files.length; i++)
         {
-            if(files[i].name == "TestAlarm.wgt")
+            if(files[i].name === "TestAlarm.wgt")
             {
                 var Url1 = files[i].toURI();
                 installUrl = Url1.replace("file:///", "/");
@@ -154,7 +154,7 @@ function addAlarmAbsolute() {
     time = $("#alarm-time").prop("value"),
     year, month, date, hours, minutes, splits, d, t;
 
-    if (time == null || time == "" || period < 0) {
+    if (time === null || time === "" || period < 0) {
         alert("Getting alarm settings failed");
     }
     else
@@ -270,7 +270,7 @@ function alarmPre() {
     function onsuccess(files) {
         for (var i = 0; i < files.length; i++)
         {
-            if(files[i].name == "TestAlarm")
+            if(files[i].name === "TestAlarm")
             {
                 documentsDir.copyTo(
                     files[i].fullPath,
old mode 100644 (file)
new mode 100755 (executable)
index 9162871..cb6d662
@@ -182,7 +182,6 @@ function connectToServer() {
     function onSocketError(e) {
         console.log("Socket error: " + e.message);
         serverConnected = false;
-        socket.close();
     }
     function onError(e) {
         console.log("Operation error");
index d18eb868f1e2ee76b56ae4da3840e04814062fba..221e75e89336ceba1a5dfcb669b72135d00af184 100755 (executable)
@@ -46,6 +46,10 @@ Authors:
             <li>
                 <input type="password" id="passwd" value="" />
             </li>
+            <li data-role="list-divider">OMA DS Server Database URI</li>
+            <li>
+                <input type="text" id="database" value="" />
+            </li>
             <li data-role="list-divider">OMA DS Server Connect</li>
             <li>
                 <div data-role="button" onclick="addProfile();">Add Profile</div>
@@ -68,7 +72,7 @@ Authors:
             <p>- http://my.funambol.com/sync</p>
             <p>- https://www.everdroid.com/web</p>
             <p>- OMA DS 1.2 protocol Server</p><br>
-            <p>1. Fill in preset OMA DS Server, ID, Password containing data to sync</p>
+            <p>1. Fill in preset OMA DS Server, ID, Password and Database URI containing data to sync</p>
             <p>2. Click Add Profile</p>
             <p>3. Click Start Sync</p>
             <p>4. Check the contacts are synchronized with the OMA DS server</p>
old mode 100644 (file)
new mode 100755 (executable)
index c75306c..37dff3d
@@ -19,7 +19,7 @@ Authors:
 */
 
 var profileId = null;
-var account, passwd, url;
+var account, passwd, url, database;
 
 var init = function () {
     serverGuide();
@@ -34,12 +34,13 @@ function addProfile() {
         account = $("#account").val();
         passwd = $("#passwd").val();
         url = $("#url").val();
+        database = $("#database").val();
 
         // Create a sync info.
         var syncInfo = new tizen.SyncInfo(url, account, passwd, "MANUAL", "REFRESH_FROM_SERVER");
 
         // Sync both contacts and events.
-        var contactInfo = new tizen.SyncServiceInfo(true, "CONTACT", "card");
+        var contactInfo = new tizen.SyncServiceInfo(true, "CONTACT", database);
         var serviceInfo = [contactInfo];
 
         // Adds a profile to sync.
@@ -58,7 +59,7 @@ function startSync() {
     var syncProgressCallback = {
             onprogress: function (profileId, serviceType, isFromServer, totalPerType, syncedPerType) {
                 console.log('Total: ' + totalPerType + ', synced: ' + syncedPerType + ', for the sync type: ' + serviceType);
-                total = syncedPerType;
+                total = totalPerType;
             },
             onstopped: function (profileId) {
                 removeProfile();
old mode 100644 (file)
new mode 100755 (executable)
index 592e6c3..faecc92
@@ -144,7 +144,7 @@ function mmsSuccessCallback(services) {
         mms.body.plainBody = "BehaviorTC MMS Messaging Test\n" + day + ", " + month + " " + date + ", " + year + ". " + h + ":" + m + ":" + s;
         mms.to = [$("#tel").val()];
         mms.subject = "BehaviorTC Messaging Test";
-        mms.attachments = [new tizen.MessageAttachment("wgt-package/tests/Messaging(SMS.MMS)/res/image.png", "image/png")];
+        mms.attachments = [new tizen.MessageAttachment("wgt-package/tests/MessagingSMSMMS/res/image.png", "image/png")];
         services[0].sendMessage(mms, messageSent, messageFailed);
     }
 }
@@ -159,4 +159,4 @@ function messageFailed(error) {
 
 function errorCallback(error) {
     alert("Cannot get messaging service " + error.message);
-}
+}
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index 9840e1c..0aeef2c
@@ -43,9 +43,10 @@ $(document).delegate("#main", "pageinit", function() {
     } catch (err) {
         console.log (err.name + ": " + err.message);
     }
-    setPower();
-    setTagListener();
-    setPeerListener();
+    setPower(function(){
+        setTagListener();
+        setPeerListener();    
+    });
 });
 
 function writeMsg() {
@@ -59,15 +60,17 @@ function writeMsg() {
         newMessage.records[0] = new tizen.NDEFRecordText(writeMessage, "en-US");
 }
 
-function setPower() {
+function setPower(onpowered) {
     var gNfcAdapter;
     try {
         gNfcAdapter = tizen.nfc.getDefaultAdapter();
         if (!gNfcAdapter.powered) {
             gNfcAdapter.setPowered(
                     true,
-                    function () {console.log("Power on succeed");},
+                    function () {onpowered();console.log("Power on succeed");},
                     function () {console.log("Power on failed")});
+        } else {
+            onpowered();
         }
     } catch (err) {
         console.log (err.name + ": " + err.message);
@@ -125,6 +128,14 @@ function setPeerListener() {
     var onSuccessCB = {
             onattach : function(nfcPeer) {
                 console.log("NFC Target is detected");
+
+                nfcPeer.setReceiveNDEFListener(
+                        function(message){
+                            readMessage = message.records[0].text;
+                            alert("Receive message : " + readMessage);
+                            document.getElementById("rmsg").innerHTML = readMessage;
+                            nfcPeer.unsetReceiveNDEFListener();
+                        });
                 nfcPeer.sendNDEF(
                         newMessage,
                         function(){
@@ -133,13 +144,6 @@ function setPeerListener() {
                         function(e){
                             console.log(e.message);
                         });
-                nfcPeer.setReceiveNDEFListener(
-                        function(message){
-                            readMessage = message.records[0].text;
-                            alert("Receive message : " + readMessage);
-                            document.getElementById("rmsg").innerHTML = readMessage;
-                            nfcPeer.unsetReceiveNDEFListener();
-                        });
             },
             ondetach : function() {
                 console.log("NFC Target is detached");
index 101fc5c33c9418fa76e9729fe0004ecea994929e..360fe0de6beb746ca1b7ba108944229c4513786c 100755 (executable)
@@ -57,7 +57,8 @@ Authors:
         </div>
         <div data-role="popup" id="popup_info">
             <font style="font-size:85%">
-                <p>Check if PushClient gets messages from the push server</p><br>
+                <p>Check if PushClient gets messages from the push server</p>
+                <p>A network connection capable of accessing the Internet MUST be established </p><br>
                 <p>1. Install and launch PushClient(TestPush) Application</p>
                 <p>   (Make sure the device is online and the applications shows registration success popup.)
                 <p>2. Press Hide in the PushClient</p>
old mode 100644 (file)
new mode 100755 (executable)
index 538b9e7..bb73af7
@@ -20,7 +20,6 @@ Authors:
 
 var installUrl;
 var reg;
-var status;
 
 $(document).delegate("#main", "pageinit", function() {
     $("#install").bind("vclick", function() {
@@ -34,11 +33,7 @@ $(document).delegate("#main", "pageinit", function() {
         return false;
     });
     $("#push").bind("vclick", function() {
-        tizen.systeminfo.getPropertyValue("WIFI_NETWORK", function onWifiNetworkSuccess(wifi){status = wifi.status});
-        if(status)
-            regID();
-        else
-            alert("Check network connection");
+        regID();
         return false;
     });
     $("#launch").addClass("ui-disabled");