Modify Security function
authoryuhanx.xu <yuhanx.xu@intel.com>
Mon, 24 Jun 2013 10:35:12 +0000 (18:35 +0800)
committerwanmingx.lin <wanmingx.lin@intel.com>
Mon, 24 Jun 2013 10:50:01 +0000 (18:50 +0800)
Signed-off-by: yuhanx.xu <yuhanx.xu@intel.com>
tests/Security/css/style.css [new file with mode: 0644]
tests/Security/index.html
tests/Security/js/main.js

diff --git a/tests/Security/css/style.css b/tests/Security/css/style.css
new file mode 100644 (file)
index 0000000..9148460
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+Copyright (c) 2013 Intel Corporation.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of works must retain the original copyright notice, this list
+  of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the original copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors
+  may be used to endorse or promote products derived from this work without
+  specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Authors:
+        Lin, Wanming <wanmingx.lin@intel.com>
+
+*/
+
+#content ul ul {
+    padding: 5px 15px;
+}
+
+.containing-element .ui-slider-switch { width: 8em }
+
+/*over write*/
+ul .ui-corner-all {
+    -moz-border-radius: 0 /*{global-radii-blocks}*/;
+    -webkit-border-radius: 0 /*{global-radii-blocks}*/;
+    border-radius: 0 /*{global-radii-blocks}*/;
+}
\ No newline at end of file
index c9d8be0..b32d50b 100755 (executable)
@@ -34,6 +34,7 @@ Authors:
         <meta charset="utf-8" />
         <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width">
         <link rel="stylesheet" type="text/css" href="../../css/jquery.mobile.css" />
+        <link rel="stylesheet" type="text/css" href="css/style.css" />
         <script src="../../js/thirdparty/jquery.js"></script>
         <script src="../../js/thirdparty/jquery.mobile.js"></script>
         <script src="../../js/tests.js"></script>
@@ -43,48 +44,36 @@ Authors:
         <div data-role="header">
             <h1 id="main_page_title"></h1>
         </div>
-        <div data-role="content">
-            <div data-role="collapsible-set" data-inset="false" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d">
-                <div data-role="collapsible" data-collapsed="true">
-                    <h3 id="homeList">Home Directory</h3>
-                    <ul data-role="listview" data-split-icon="delete" data-split-theme="c" data-inset="true" id="home">
-                        <li class="ui-li ui-li-static" data-icon="false" data-theme="">
-                            <a href="#" align="center" id="homeBtn" data-rel="popup" data-position-to="window" data-transition="pop">Create file</a>
-                        </li>
-                    </ul>
-                </div>
-                <div data-role="collapsible" data-collapsed="true">
-                    <h3 id="mediaList">Shared Media Directory</h3>
-                    <ul data-role="listview" data-split-icon="delete" data-split-theme="c" data-inset="true" id="media">
-                        <li class="ui-li ui-li-static" data-icon="false" data-theme="">
-                            <a href="#" align="center" id="mediaBtn" data-rel="popup" data-position-to="window" data-transition="pop">Create file</a>
-                        </li>
-                    </ul>
-                </div>
-                <div data-role="collapsible" data-collapsed="true">
-                    <h3 id="systemList">Shared System Directory</h3>
-                    <ul data-role="listview" data-split-icon="delete" data-split-theme="c" data-inset="true" id="system">
-                        <li class="ui-li ui-li-static" data-icon="false" data-theme="">
-                            <a href="#" align="center" id="systemBtn" data-rel="popup" data-position-to="window" data-transition="pop">Create file</a>
-                        </li>
-                    </ul>
-                </div>
-                <div data-role="collapsible" data-collapsed="true">
-                    <h3>Etc Directory</h3>
-                    <ul data-role="listview" data-split-icon="delete" data-split-theme="c" data-inset="true" id="etc">
-                        <li class="ui-li ui-li-static" data-icon="false" data-theme="">
-                            <a href="#" align="center" id="etcBtn" data-rel="popup" data-position-to="window" data-transition="pop">Open Directory</a>
-                        </li>
-                    </ul>
-                </div>
-            </div>
+        <div id="content">
+            <ul data-role="listview">
+                <li data-role="list-divider">Home Directory</li>
+                <li><div data-role="button" id="openHomeBtn">Open Directory</div></li>
+                <li><div data-role="button" id="homeBtn">Create File</div></li>
+                <ul data-role="listview" id="home" data-inset="true"></ul>
+            </ul>
+            <ul data-role="listview">
+                <li data-role="list-divider">Shared Media Directory</li>
+                <li><div data-role="button" id="openMediaBtn">Open Directory</div></li>
+                <li><div data-role="button" id="mediaBtn">Create File</div></li>
+                <ul data-role="listview" id="media" data-inset="true"></ul>
+            </ul>
+            <ul data-role="listview">
+                <li data-role="list-divider">Shared System Directory</li>
+                <li><div data-role="button" id="openSystemBtn">Open Directory</div></li>
+                <li><div data-role="button" id="systemBtn">Create File</div></li>
+                <ul data-role="listview" id="system" data-inset="true"></ul>
+            </ul>
+            <ul data-role="listview" >
+                <li data-role="list-divider">Etc Directory</li>
+                <li><div data-role="button" id="openEtcBtn">Open Directory</div></li>
+            </ul>
         </div>
         <div data-role="footer" data-position="fixed">
         </div>
         <div data-role="popup" id="popup_info">
           <font style="font-size:85%">
             <p>Test Purpose: </p>
-            <p>Verifies the "USER" of running Applications should be non-root ID and an application only allows user to manipulate files in the following locations: home directory, shared media directory, shared system directory. Get the "USER" info via cmdline "ps -aux | awk 'NR==tctbhtests.TCTBehaviorTests/'" in console. Manipulate files in home, shared media, shared system and etc directory through 4 buttons on the screen.</p>
+            <p>Verifies the "USER" of running Applications should be non-root ID and an application only allows user to manipulate files in the following locations: home directory, shared media directory, shared system directory. Get the "USER" info via cmdline "ps aux|awk 'NR==1;/tctbhtests\.TCTBehaviorTests/'" in console. Manipulate files in home, shared media, shared system and etc directory through 4 buttons on the screen.</p>
             <p>Expected Result: </p>
             <p>This test PASS only if the test Application runs under a non-root ID and user could manipulate files in home, shared media, shared system directory but not ect directory.</p>
           </font>
index f210494..82d7578 100755 (executable)
@@ -51,13 +51,13 @@ $(document).ready(function(){
                     + '</h4></a><a href="'
                     + 'javascript:deleteFile('
                     + count
-                    + ')" data-rel="popup" data-position-to="window" data-transition="pop">'
+                    + ')" data-icon="delete" data-theme="c">'
                     + '</a></li>';
                 gFiles[count++] = files[i];
             }
         }
         if (str) {
-            $(selector).prepend(str).trigger("create").listview("refresh");
+            $(selector).append(str).trigger("create").listview("refresh");
         }
     }
 
@@ -65,15 +65,42 @@ $(document).ready(function(){
         try {
             tizen.filesystem.resolve(str, function(dir) {
                 dir.listFiles(function(files) {
+                    makeFileList(files, selector);
                     switch (str) {
-                        case "/home/": homeDir = dir; break;
-                        case "/opt/media/": mediaDir = dir; break;
-                        case "/usr/share/": systemDir = dir; break;
-                        case "/etc/": etcDir = dir; break;
+                        case "/home/": {
+                            homeDir = dir;
+                            alert("Open Success");
+                            break;
+                        }
+                        case "/opt/media/": {
+                            mediaDir = dir;
+                            alert("Open Success");
+                            break;
+                        }
+                        case "/usr/share/": {
+                            systemDir = dir;
+                            alert("Open Success");
+                            break;
+                        }
+                        case "/etc/": {
+                            etcDir = dir;
+                            alert("Open Success");
+                            break;
+                        }
                         default: break;
                     }
-                    makeFileList(files, selector);
-                }, onError);
+                }, function(err) {
+                    switch (str) {
+                        case "/home/":
+                        case "/opt/media/":
+                        case "/usr/share/":
+                        case "/etc/": {
+                            alert("Open Fail: " + err.message);
+                            break;
+                        }
+                        default: break;
+                    }
+                });
             }, onError, "rw");
         } catch (exc) {
             alert("tizen.filesystem.resolve(" + str + ") exc: " + exc.message);
@@ -97,11 +124,11 @@ $(document).ready(function(){
                 + '</h4></a><a href="'
                 + 'javascript:deleteFile('
                 + count
-                + ')" data-rel="popup" data-position-to="window" data-transition="pop">'
+                + ')" data-icon="delete" data-theme="c">'
                 + '</a></li>';
             gFiles[count++] = newFile;
             if (str) {
-                $(selector).prepend(str).trigger("create").listview("refresh");
+                $(selector).append(str).trigger("create").listview("refresh");
             }
         } catch (exc) {
             alert("Create File Error: " + exc.message);
@@ -121,26 +148,32 @@ $(document).ready(function(){
         checkEnable();
     });
 
-    $("#etcBtn").on("click",function() {
-        if (!etcDir) {
-            openDirectory("/etc/", "#etc");
-            etcFlag = true;
-            checkEnable();
-        }
-    });
-    $("#homeList").on("click",function() {
-        if (!homeDir && ($(this).parent().attr("class") == "ui-collapsible")) {
+    $("#openHomeBtn").on("click",function() {
+        if (!homeDir) {
             openDirectory("/home/", "#home");
+        } else {
+            alert("Already Opened");
         }
     });
-    $("#mediaList").on("click",function() {
-        if (!mediaDir && ($(this).parent().attr("class") == "ui-collapsible")) {
+    $("#openMediaBtn").on("click",function() {
+        if (!mediaDir) {
             openDirectory("/opt/media/", "#media");
+        } else {
+            alert("Already Opened");
         }
     });
-    $("#systemList").on("click",function() {
-        if (!systemDir && ($(this).parent().attr("class") == "ui-collapsible")) {
+    $("#openSystemBtn").on("click",function() {
+        if (!systemDir) {
             openDirectory("/usr/share/", "#system");
+        } else {
+            alert("Already Opened");
+        }
+    });
+    $("#openEtcBtn").on("click",function() {
+        if (!etcDir) {
+            openDirectory("/etc/", "#etc");
+            etcFlag = true;
+            checkEnable();
         }
     });
 
@@ -177,4 +210,4 @@ function checkEnable() {
     if (homeDir && mediaDir && systemDir && etcFlag) {
         EnablePassButton();
     }
-}
\ No newline at end of file
+}