Add capability info to result xml file.
authorFan,Yugang <yugang.fan@intel.com>
Tue, 30 Jul 2013 05:32:49 +0000 (13:32 +0800)
committerFan,Yugang <yugang.fan@intel.com>
Tue, 30 Jul 2013 05:32:49 +0000 (13:32 +0800)
js/main.js

index 1239bbc..c50e500 100755 (executable)
@@ -220,6 +220,7 @@ function loadTests() {
         success : function(xml){
             _resultXML = xml;
             Tests = $(xml).find("testcase");
+            getSummary();
             getCapPresent();
             loadTmpResult();
         }
@@ -317,6 +318,35 @@ function initTests() {
     }, false);
 }
 
+function getSummary() {
+    var summaryXML = "";
+
+    if (tizen.systeminfo == 'undefined') {
+        return;
+    } else {
+        summaryXML += "<capabilities>";
+        var caps = tizen.systeminfo.getCapabilities();
+        for (x in caps) {
+            if (typeof(caps[x]) == "boolean")
+                summaryXML += "    <capability name=\"" + x + "\" support=\"" + caps[x] + "\" type=\"boolean\"/>\r\n";
+            else {
+                if (typeof(caps[x]) == "number")
+                    summaryXML += "    <capability name=\"" + x + "\" support=\"true\" type=\"Integer\">\r\n";
+                else if (typeof(caps[x]) == "string")
+                    summaryXML += "    <capability name=\"" + x + "\" support=\"true\" type=\"String\">\r\n";
+                else
+                    summaryXML += "    <capability name=\"" + x + "\" support=\"true\" type=\"" + typeof(caps[x]) + "\">\r\n";
+                summaryXML += "        <value>" + caps[x] + "</value>\r\n";
+                summaryXML += "    </capability>\r\n";
+            }
+        }
+        summaryXML += "</capabilities>";
+    }
+    var summaryDoc = $.parseXML(summaryXML);
+    var testDef = $(_resultXML).find("test_definition");
+    $(testDef[0]).prepend(summaryDoc.documentElement);
+}
+
 function getCapPresent() {
     try {
         caps = tizen.systeminfo.getCapabilities();