Test for enabling permissions for EFL apps
authorJan Cybulski <j.cybulski@samsung.com>
Thu, 1 Aug 2013 08:02:46 +0000 (10:02 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 23 Jan 2014 14:04:28 +0000 (15:04 +0100)
    [Issue#]       SSDWSSP-436
    [Feature]      Tests for privileges efl applications.
    [Cause]        Adding EFL app type in libprivilege-control.
    [Solution]     Simple testing wether perm_app_enable_permissions works with APP_TYPE_EFL.
    [Verification] Run the tests.

Change-Id: I36370e78f97670ee5185d843d862aefea6f824e0

tests/libprivilege-control-tests/CMakeLists.txt
tests/libprivilege-control-tests/EFL_test_privilege_control_rules_efl.smack [new file with mode: 0644]
tests/libprivilege-control-tests/test_cases.cpp

index 34fbec9..3716eed 100644 (file)
@@ -149,3 +149,9 @@ INSTALL(FILES
     ${PROJECT_SOURCE_DIR}/tests/libprivilege-control-tests/OSP_test_privilege_control_rules_osp.dac
     DESTINATION /usr/share/privilege-control/
   )
+
+
+INSTALL(FILES
+    ${PROJECT_SOURCE_DIR}/tests/libprivilege-control-tests/EFL_test_privilege_control_rules_efl.smack
+    DESTINATION /usr/share/privilege-control/
+  )
\ No newline at end of file
diff --git a/tests/libprivilege-control-tests/EFL_test_privilege_control_rules_efl.smack b/tests/libprivilege-control-tests/EFL_test_privilege_control_rules_efl.smack
new file mode 100644 (file)
index 0000000..5438c54
--- /dev/null
@@ -0,0 +1 @@
+~APP~ test_book_efl r
index 6ba98c6..237fa4a 100644 (file)
@@ -1842,6 +1842,26 @@ RUNNER_TEST(privilege_control11_app_enable_permissions)
         "Error revoking app permissions. Result: " << result);
 }
 
+RUNNER_CHILD_TEST(privilege_control11_app_enable_permissions_efl)
+{
+    int result;
+    const char *PRIVS_EFL[] = { "test_privilege_control_rules_efl", NULL };
+
+    result = perm_app_install("EFL_APP");
+    RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+            "perm_app_install failed: " << result);
+
+    result = perm_app_enable_permissions("EFL_APP", APP_TYPE_EFL, PRIVS_EFL, 0);
+    RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+        "Error enabling app permissions. Result: " << result);
+
+    RUNNER_ASSERT_MSG( smack_have_access("EFL_APP","test_book_efl", "r"),
+            "SMACK accesses not granted for EFL_APP");
+
+    (void)perm_app_uninstall("EFL_APP");
+}
+
+
 /*
  * Until perm_app_disable_permissions is not fixed this test should remain
  * commented