Changed HAL test binary name to accordance with HAL test RPM package name. 98/187098/1
authorsaerome.kim <saerome.kim@samsung.com>
Mon, 20 Aug 2018 02:32:24 +0000 (11:32 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 20 Aug 2018 02:32:24 +0000 (11:32 +0900)
Change-Id: I014a14ecb6901bb938ac98e3cf4ad33c656b7d41
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
haltest/capi-network-nfc-haltests.cpp [new file with mode: 0644]
haltest/nfc_manager_hal_tc.cpp [deleted file]
packaging/capi-network-nfc.spec

diff --git a/haltest/capi-network-nfc-haltests.cpp b/haltest/capi-network-nfc-haltests.cpp
new file mode 100644 (file)
index 0000000..15595e7
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <iostream>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <nfc.h>
+#include <system_info.h>
+#include "unittest.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+void __activated(bool activated, void *user_data) {
+       std::cout<< (activated ? "activated" : "deactivated") << std::endl;
+}
+
+static bool __check_feature_supported(char *key)
+{
+       bool value = false;
+       int ret = system_info_get_platform_bool(key, &value);
+
+       EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+       EXPECT_EQ(true, value) << key << " feature is not supported";
+
+       return value;
+}
+
+/*
+@testcase      Init_p
+@since_tizen   5.0
+@author                SRID(abhishek.s94)
+@reviewer      HQ(jh8801.jung)
+@type          auto
+@description   Positive, Initialize NFC manager
+@apicovered    nfc_manager_initialize
+@passcase      when nfc_manager_initialize returns NFC_ERROR_NONE
+@failcase      when nfc_manager_initialize does not return NFC_ERROR_NONE
+@precondition  __check_feature_supported must return true for nfc feature
+@postcondition None
+*/
+TEST(Hal_nfc, Init_p)
+{
+       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
+       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
+
+       nfc_manager_set_activation_changed_cb(__activated, NULL);
+       int rv = nfc_manager_initialize();
+       EXPECT_EQ(NFC_ERROR_NONE, rv) << "Initialization failure";
+
+}
+
+/*
+@testcase      Set_Activation_true_p
+@since_tizen   5.0
+@author                SRID(abhishek.s94)
+@reviewer      HQ(jh8801.jung)
+@type          auto
+@description   Positive, Activate NFC manager
+@apicovered    nfc_manager_set_activation
+@passcase      when nfc_manager_set_activation returns NFC_ERROR_NONE or NFC_ERROR_ALREADY_ACTIVATED
+@failcase      when nfc_manager_set_activation does not return NFC_ERROR_NONE or NFC_ERROR_ALREADY_ACTIVATED
+@precondition  __check_feature_supported must return true for nfc feature
+@postcondition None
+*/
+TEST(Hal_nfc, Set_Activation_true_p)
+{
+       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
+       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
+
+       int rv = nfc_manager_set_activation(true, NULL, NULL);
+       sleep(5);
+       EXPECT_EQ(rv == NFC_ERROR_NONE || rv == NFC_ERROR_ALREADY_ACTIVATED, true)
+               << "Activation failure";
+}
+
+/*
+@testcase      Set_Activation_false_p
+@since_tizen   5.0
+@author                SRID(abhishek.s94)
+@reviewer      HQ(jh8801.jung)
+@type          auto
+@description   Positive, Deactivate NFC manager
+@apicovered    nfc_manager_set_activation
+@passcase      when nfc_manager_set_activation returns NFC_ERROR_NONE
+@failcase      when nfc_manager_set_activation does not return NFC_ERROR_NONE
+@precondition  __check_feature_supported must return true for nfc feature
+@postcondition None
+*/
+TEST(Hal_nfc, Set_Activation_false_p)
+{
+       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
+       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
+
+       int rv = nfc_manager_set_activation(false, NULL, NULL);
+       EXPECT_EQ(NFC_ERROR_NONE, rv) << "Deactivation failure";
+}
+
+/*
+@testcase      Deinit_p
+@since_tizen   5.0
+@author                SRID(abhishek.s94)
+@reviewer      HQ(jh8801.jung)
+@type          auto
+@description   Positive, Deinitialize NFC manager
+@apicovered    nfc_manager_deinitialize
+@passcase      when nfc_manager_deinitialize returns NFC_ERROR_NONE
+@failcase      when nfc_manager_deinitialize does not return NFC_ERROR_NONE
+@precondition  __check_feature_supported must return true for nfc feature
+@postcondition None
+*/
+TEST(Hal_nfc, Deinit_p)
+{
+       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
+       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
+
+       int rv = nfc_manager_deinitialize();
+       EXPECT_EQ(NFC_ERROR_NONE, rv) << "De-initialization failure";
+}
+
+int main(int argc, char **argv)
+{
+       int ret = 0;
+       try {
+               testing::InitGoogleTest(&argc, argv);
+       } catch (const ::testing::internal::GoogleTestFailureException& ex) {
+               std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
+       } catch (...) {
+               std::cerr << "Caught: unknown exception" << std::endl;
+       }
+
+       try {
+               ret = RUN_ALL_TESTS();
+       } catch (const ::testing::internal::GoogleTestFailureException& ex) {
+               std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
+       } catch (...) {
+               std::cerr << "Caught: unknown exception" << std::endl;
+       }
+       return ret;
+}
diff --git a/haltest/nfc_manager_hal_tc.cpp b/haltest/nfc_manager_hal_tc.cpp
deleted file mode 100644 (file)
index 15595e7..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <iostream>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <nfc.h>
-#include <system_info.h>
-#include "unittest.h"
-
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-
-void __activated(bool activated, void *user_data) {
-       std::cout<< (activated ? "activated" : "deactivated") << std::endl;
-}
-
-static bool __check_feature_supported(char *key)
-{
-       bool value = false;
-       int ret = system_info_get_platform_bool(key, &value);
-
-       EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
-       EXPECT_EQ(true, value) << key << " feature is not supported";
-
-       return value;
-}
-
-/*
-@testcase      Init_p
-@since_tizen   5.0
-@author                SRID(abhishek.s94)
-@reviewer      HQ(jh8801.jung)
-@type          auto
-@description   Positive, Initialize NFC manager
-@apicovered    nfc_manager_initialize
-@passcase      when nfc_manager_initialize returns NFC_ERROR_NONE
-@failcase      when nfc_manager_initialize does not return NFC_ERROR_NONE
-@precondition  __check_feature_supported must return true for nfc feature
-@postcondition None
-*/
-TEST(Hal_nfc, Init_p)
-{
-       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
-       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
-
-       nfc_manager_set_activation_changed_cb(__activated, NULL);
-       int rv = nfc_manager_initialize();
-       EXPECT_EQ(NFC_ERROR_NONE, rv) << "Initialization failure";
-
-}
-
-/*
-@testcase      Set_Activation_true_p
-@since_tizen   5.0
-@author                SRID(abhishek.s94)
-@reviewer      HQ(jh8801.jung)
-@type          auto
-@description   Positive, Activate NFC manager
-@apicovered    nfc_manager_set_activation
-@passcase      when nfc_manager_set_activation returns NFC_ERROR_NONE or NFC_ERROR_ALREADY_ACTIVATED
-@failcase      when nfc_manager_set_activation does not return NFC_ERROR_NONE or NFC_ERROR_ALREADY_ACTIVATED
-@precondition  __check_feature_supported must return true for nfc feature
-@postcondition None
-*/
-TEST(Hal_nfc, Set_Activation_true_p)
-{
-       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
-       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
-
-       int rv = nfc_manager_set_activation(true, NULL, NULL);
-       sleep(5);
-       EXPECT_EQ(rv == NFC_ERROR_NONE || rv == NFC_ERROR_ALREADY_ACTIVATED, true)
-               << "Activation failure";
-}
-
-/*
-@testcase      Set_Activation_false_p
-@since_tizen   5.0
-@author                SRID(abhishek.s94)
-@reviewer      HQ(jh8801.jung)
-@type          auto
-@description   Positive, Deactivate NFC manager
-@apicovered    nfc_manager_set_activation
-@passcase      when nfc_manager_set_activation returns NFC_ERROR_NONE
-@failcase      when nfc_manager_set_activation does not return NFC_ERROR_NONE
-@precondition  __check_feature_supported must return true for nfc feature
-@postcondition None
-*/
-TEST(Hal_nfc, Set_Activation_false_p)
-{
-       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
-       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
-
-       int rv = nfc_manager_set_activation(false, NULL, NULL);
-       EXPECT_EQ(NFC_ERROR_NONE, rv) << "Deactivation failure";
-}
-
-/*
-@testcase      Deinit_p
-@since_tizen   5.0
-@author                SRID(abhishek.s94)
-@reviewer      HQ(jh8801.jung)
-@type          auto
-@description   Positive, Deinitialize NFC manager
-@apicovered    nfc_manager_deinitialize
-@passcase      when nfc_manager_deinitialize returns NFC_ERROR_NONE
-@failcase      when nfc_manager_deinitialize does not return NFC_ERROR_NONE
-@precondition  __check_feature_supported must return true for nfc feature
-@postcondition None
-*/
-TEST(Hal_nfc, Deinit_p)
-{
-       g_bFeatureNfc = __check_feature_supported((char*)FEATURE_NFC);
-       ASSERT_EQ(true, g_bFeatureNfc) << FEATURE_NFC << " feature is not supported";
-
-       int rv = nfc_manager_deinitialize();
-       EXPECT_EQ(NFC_ERROR_NONE, rv) << "De-initialization failure";
-}
-
-int main(int argc, char **argv)
-{
-       int ret = 0;
-       try {
-               testing::InitGoogleTest(&argc, argv);
-       } catch (const ::testing::internal::GoogleTestFailureException& ex) {
-               std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
-       } catch (...) {
-               std::cerr << "Caught: unknown exception" << std::endl;
-       }
-
-       try {
-               ret = RUN_ALL_TESTS();
-       } catch (const ::testing::internal::GoogleTestFailureException& ex) {
-               std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
-       } catch (...) {
-               std::cerr << "Caught: unknown exception" << std::endl;
-       }
-       return ret;
-}
index 81dadf6a0ec39284403ac2772044e8e4d7427695..5c59ba051ae8e608752c28a542b8632a0fc04683 100644 (file)
@@ -81,4 +81,4 @@ rm -rf %{buildroot}
 
 %files haltests
 %manifest %{name}.manifest
-%{_bindir}/*hal_tc
+%{_bindir}/*haltests