[mobile][wearable][nfc][change path for supporting global user and sync test case... 30/111230/1
authormengli.zhang <mengli.zhang@samsung.com>
Fri, 20 Jan 2017 15:12:58 +0000 (10:12 -0500)
committermengli.zhang <mengli.zhang@samsung.com>
Fri, 20 Jan 2017 15:13:18 +0000 (10:13 -0500)
Change-Id: I848fae63b9d24a5d7f7b1919fce0f56c9afba875
Signed-off-by: mengli.zhang <mengli.zhang@samsung.com>
mobile/tct-nfc-tizen-tests/inst.wgt.py
mobile/tct-nfc-tizen-tests/nfc/NFCAdapter_addHCEEventListener.html
mobile/tct-nfc-tizen-tests/resources/testharness.js
wearable/tct-nfc-tizen-tests/inst.wgt.py
wearable/tct-nfc-tizen-tests/nfc/HCEEventData_apdu_attribute.html
wearable/tct-nfc-tizen-tests/nfc/NFCAdapter_addHCEEventListener.html
wearable/tct-nfc-tizen-tests/nfc/NFCAdapter_sendHostAPDUResponse.html
wearable/tct-nfc-tizen-tests/tests.xml

index 5b1718da169ebc796a16962b47a209f160af24d9..93ac8ad714963bd2c8c224982d78ae0ac055b042 100644 (file)
@@ -20,7 +20,15 @@ tct_parser = ConfigParser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')
+ADMIN_USER_30 = tct_parser.get('DEVICE', 'DEVICE_ADMIN_USER_30')
 
+def userCheck():
+    global GLOVAL_OPT
+    if ADMIN_USER_30 == EXECUTION_MODE_30:
+        GLOVAL_OPT="--global"
+    else:
+        GLOVAL_OPT=""
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
@@ -116,7 +124,7 @@ def uninstPKGs():
                     action_status = False
                     continue
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -u -t wgt -q -n %s" % pkg_id)
+                    "pkgcmd %s -u -t wgt -q -n %s" % (GLOVAL_OPT, pkg_id))
                 for line in output:
                     if "Failure" in line:
                         action_status = False
@@ -145,7 +153,7 @@ def instPKGs():
                 if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
                     action_status = False
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -i -t wgt -q -p %s/%s" % (SRC_DIR, file))
+                    "pkgcmd %s -i -t wgt -q -p %s/%s" % (GLOVAL_OPT, SRC_DIR, file))
                 doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
                 for line in output:
                     if "Failure" in line:
@@ -187,7 +195,7 @@ def main():
         sys.exit(1)
 
     if not PARAMETERS.user:
-        PARAMETERS.user = "owner"
+        PARAMETERS.user = EXECUTION_MODE_30
     if not PARAMETERS.mode:
         PARAMETERS.mode = "SDB"
 
@@ -205,6 +213,8 @@ def main():
         print "No device provided"
         sys.exit(1)
 
+    userCheck()
+
     user_info = getUSERID()
     re_code = user_info[0]
     if re_code == 0 :
index 2a1277779eb14dffa18ab8d1fc1ff99e9367732f..bb0760811b3de489472c328f2316b6f05b38d7cf 100644 (file)
@@ -48,7 +48,7 @@ var t = async_test(document.title, {timeout: 90000}), adapter, eventCallback, li
 t.step(function () {
     eventCallback = t.step_func(function (eventdata) {
         assert_own_property(eventdata, "length", "HCEEventData does not own length property.");
-        check_readonly(eventdata, eventdata.length, "number", eventdata.length + 1);
+        check_readonly(eventdata, "length", eventdata.length, "number", eventdata.length + 1);
         adapter.removeHCEEventListener(listenerId);
         t.done();
     });
index 9311cd3500f84fdc565a9bcaf4873952d0bbec40..17ba37d24f7b25fa4460483c71e32ba8225eba95 100644 (file)
@@ -358,8 +358,8 @@ policies and contribution forms [3].
     // default timeout is 5 seconds, test can override if needed
     var settings = {
       output:true,
-      timeout:5000,
-      test_timeout:2000
+      timeout:50000,
+      test_timeout:20000
     };
 
     var xhtml_ns = "http://www.w3.org/1999/xhtml";
index 5b1718da169ebc796a16962b47a209f160af24d9..b48c5c232cdf4d5654985314dc2e31bc422ad4b1 100644 (file)
@@ -20,7 +20,15 @@ tct_parser = ConfigParser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')
+ADMIN_USER_30 = tct_parser.get('DEVICE', 'DEVICE_ADMIN_USER_30')
 
+def userCheck():
+    global GLOVAL_OPT
+    if ADMIN_USER_30 == EXECUTION_MODE_30:
+        GLOVAL_OPT="--global"
+    else:
+        GLOVAL_OPT=""
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
@@ -116,7 +124,7 @@ def uninstPKGs():
                     action_status = False
                     continue
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -u -t wgt -q -n %s" % pkg_id)
+                    "pkgcmd %s -u -t wgt -q -n %s" % (GLOVAL_OPT, pkg_id))
                 for line in output:
                     if "Failure" in line:
                         action_status = False
@@ -145,13 +153,22 @@ def instPKGs():
                 if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
                     action_status = False
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -i -t wgt -q -p %s/%s" % (SRC_DIR, file))
+                    "pkgcmd %s -i -t wgt -q -p %s/%s" % (GLOVAL_OPT, SRC_DIR, file))
+                doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
+                for line in output:
+                    if "Failure" in line:
+                        action_status = False
+                        break
+            if file.endswith(".tpk"):
+                if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
+                    action_status = False
+                (return_code, output) = doRemoteCMD(
+                    "pkgcmd -i -t tpk -q -p %s/%s" % (SRC_DIR, file))
                 doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
                 for line in output:
                     if "Failure" in line:
                         action_status = False
                         break
-
     # Do some special copy/delete... steps
     '''
     (return_code, output) = doRemoteCMD(
@@ -187,7 +204,7 @@ def main():
         sys.exit(1)
 
     if not PARAMETERS.user:
-        PARAMETERS.user = "owner"
+        PARAMETERS.user = EXECUTION_MODE_30
     if not PARAMETERS.mode:
         PARAMETERS.mode = "SDB"
 
@@ -205,6 +222,8 @@ def main():
         print "No device provided"
         sys.exit(1)
 
+    userCheck()
+
     user_info = getUSERID()
     re_code = user_info[0]
     if re_code == 0 :
index ab6e115b8aee8f8f8bc9b93f15ff90756bf0d249..2893ec259daa702fba2a795b5a894cc13b383f20 100644 (file)
@@ -40,9 +40,7 @@ Authors:
 //==== SPEC Tizen Web API:Communication:NFC:HCEEventData:apdu A
 //==== TEST_CRITERIA AE AT ARO
 
-setup({timeout: 90000});
-
-var t = async_test(document.title, {timeout: 90000}), adapter, listener, listenerId;
+var t = async_test(document.title), adapter, listener, listenerId;
 
 t.step(function () {
     listener = t.step_func(function (eventdata) {
index 2a1277779eb14dffa18ab8d1fc1ff99e9367732f..933ef59f135d7fb5733835d86a9bf183dfe8b0e2 100644 (file)
@@ -48,13 +48,13 @@ var t = async_test(document.title, {timeout: 90000}), adapter, eventCallback, li
 t.step(function () {
     eventCallback = t.step_func(function (eventdata) {
         assert_own_property(eventdata, "length", "HCEEventData does not own length property.");
-        check_readonly(eventdata, eventdata.length, "number", eventdata.length + 1);
+        check_readonly(eventdata, "length", eventdata.length, "number", eventdata.length + 1);
         adapter.removeHCEEventListener(listenerId);
         t.done();
     });
     adapter = tizen.nfc.getDefaultAdapter();
     listenerId = adapter.addHCEEventListener(eventCallback);
-    assert_type(listenerId, "number", "fail to get listener Id");
+    assert_type(listenerId, "long", "fail to get listener Id");
 });
 
 </script>
index 1afd94228aae7912baca742c48c1bb5146b61bba..4058cab448dba7534d778159b3c315aed87fdc0e 100644 (file)
@@ -55,13 +55,17 @@ t.step(function () {
         assert_unreached("onerror invoked.");
     });
 
-    adapter = tizen.nfc.getDefaultAdapter();
+    listener = t.step_func(function (eventdata) {
     try {
         retValue = adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
         assert_type(retValue, "undefined", "fail to get wrong type of retValue");
     } catch (e) {
         assert_unreached(e.name + ": " + e.message);
     }
+    });
+
+    adapter = tizen.nfc.getDefaultAdapter();
+    listenerId = adapter.addHCEEventListener(listener);
 
 });
 
index 01282c6ff56dd9a050102abc7daa4c3671939444..77ab0c84ca84535cbc80521e0f34dc79b031cc2e 100644 (file)
           <steps>
             <step order="1">
               <step_desc>Click "Run" . Attach device or send APDU using another device to trigger the onDetect CB.</step_desc>
-              <expected>pass - onDetect listener should be called</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - HCEEventListener is called successfully.</expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/HCEEventData_eventType_attribute.html</test_script_entry>
           <steps>
             <step order="1">
               <step_desc>Click "Run" . Attach device or send APDU using another device to trigger the onDetect CB.</step_desc>
-              <expected>pass - onDetect listener should be called</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - HCEEventListener is called successfully.</expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/HCEEventData_extend.html</test_script_entry>
           <steps>
             <step order="1">
               <step_desc>Click "Run" . Attach device or send APDU using another device to trigger the onDetect CB.</step_desc>
-              <expected>pass - onDetect listener should be called</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - HCEEventListener is called successfully.</expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/HCEEventData_length_attribute.html</test_script_entry>
           <steps>
             <step order="1">
               <step_desc>Click "Run". Move other device with HCE close so it will be detected.</step_desc>
-              <expected>Pass</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - HCEEventListener is called successfully.</expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/HCEEventReceiveCallback_ondetected.html</test_script_entry>
           <steps>
             <step order="1">
               <step_desc>Click "Run". Move other device with HCE close so it will be detected.</step_desc>
-              <expected>pass - HCE detected</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - HCEEventListener is called successfully.</expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/NFCAdapter_addHCEEventListener.html</test_script_entry>
           <steps>
             <step order="1">
               <step_desc>Click "Run". Move other device with HCE close so it will be detected.</step_desc>
-              <expected>pass - HCE event detected</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - HCEEventListener is called and removed successfully and  </expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/NFCAdapter_removeHCEEventListener.html</test_script_entry>
           <steps>
             <step order="1">
               <step_desc>Click "Run". Move other device with HCE close so it will be detected.</step_desc>
-              <expected>pass - HCE detected</expected>
+            </step>
+            <step order="2">
+              <step_desc> Send APDU data from the other device to test target.</step_desc>
+              <expected>pass - APDU data is sent in HCEEventListener </expected>
             </step>
           </steps>
           <test_script_entry>/opt/tct-nfc-tizen-tests/nfc/NFCAdapter_sendHostAPDUResponse.html</test_script_entry>