tests: Split permission denied test code 96/267296/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 1 Dec 2021 05:57:00 +0000 (14:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 1 Dec 2021 06:13:35 +0000 (15:13 +0900)
Change-Id: I51a3e26635fdef8cc7616f0cf8a4029ce3c66851
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
tests/src/inputmethod_manager_permission_unittests.cpp [new file with mode: 0644]
tests/src/inputmethod_manager_unittests.cpp

diff --git a/tests/src/inputmethod_manager_permission_unittests.cpp b/tests/src/inputmethod_manager_permission_unittests.cpp
new file mode 100644 (file)
index 0000000..ba9edcf
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <inputmethod_manager.h>
+#include "cynara_mock.h"
+#include "isf_control_mock.h"
+
+namespace {
+
+#define IME_APPID "ise-default"
+
+class InputMethodManagerDeniedTest : public testing::Test {
+    public:
+        virtual void SetUp() {
+            cynara_check_set_result(CYNARA_API_ACCESS_DENIED);
+        }
+        virtual void TearDown() {
+            cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED);
+        }
+};
+
+TEST_F(InputMethodManagerDeniedTest, utc_ime_manager_get_active_ime_permission_denied)
+{
+    int ret = ime_manager_get_active_ime(NULL);
+    EXPECT_EQ(ret, IME_MANAGER_ERROR_PERMISSION_DENIED);
+}
+
+TEST_F(InputMethodManagerDeniedTest, utc_ime_manager_get_enabled_ime_count_permission_denied)
+{
+    int count = ime_manager_get_enabled_ime_count();
+    EXPECT_EQ(count, 0);
+}
+
+TEST_F(InputMethodManagerDeniedTest, utc_ime_manager_prelaunch_ime_permission_denied)
+{
+    int ret = ime_manager_prelaunch_ime();
+    EXPECT_EQ(ret, IME_MANAGER_ERROR_PERMISSION_DENIED);
+}
+
+} // namespace
index eca3ae0..9d03cc6 100644 (file)
@@ -33,16 +33,6 @@ class InputMethodManagerTest : public testing::Test {
         }
 };
 
-class InputMethodManagerDeniedTest : public testing::Test {
-    public:
-        virtual void SetUp() {
-            cynara_check_set_result(CYNARA_API_ACCESS_DENIED);
-        }
-        virtual void TearDown() {
-            cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED);
-        }
-};
-
 TEST_F(InputMethodManagerTest, utc_ime_manager_get_active_ime_p)
 {
     char *app_id = nullptr;
@@ -60,12 +50,6 @@ TEST_F(InputMethodManagerTest, utc_ime_manager_get_active_ime_invalid_parameter)
     EXPECT_EQ(ret, IME_MANAGER_ERROR_INVALID_PARAMETER);
 }
 
-TEST_F(InputMethodManagerDeniedTest, utc_ime_manager_get_active_ime_permission_denied)
-{
-    int ret = ime_manager_get_active_ime(NULL);
-    EXPECT_EQ(ret, IME_MANAGER_ERROR_PERMISSION_DENIED);
-}
-
 TEST_F(InputMethodManagerTest, utc_ime_manager_is_ime_enabled_p)
 {
     bool enabled;
@@ -104,22 +88,10 @@ TEST_F(InputMethodManagerTest, utc_ime_manager_get_enabled_ime_count_p)
     EXPECT_GT(count, 0);
 }
 
-TEST_F(InputMethodManagerDeniedTest, utc_ime_manager_get_enabled_ime_count_permission_denied)
-{
-    int count = ime_manager_get_enabled_ime_count();
-    EXPECT_EQ(count, 0);
-}
-
 TEST_F(InputMethodManagerTest, utc_ime_manager_prelaunch_ime_p)
 {
     int ret = ime_manager_prelaunch_ime();
     EXPECT_EQ(ret, IME_MANAGER_ERROR_NONE);
 }
 
-TEST_F(InputMethodManagerDeniedTest, utc_ime_manager_prelaunch_ime_permission_denied)
-{
-    int ret = ime_manager_prelaunch_ime();
-    EXPECT_EQ(ret, IME_MANAGER_ERROR_PERMISSION_DENIED);
-}
-
 } // namespace