--- /dev/null
+/*
+ * 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 <libusb.h>
+#include <libmtp.h>
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+/*
+@testcase init_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(jh8801.jung)
+@type auto
+@description Positive, Initialize libusb
+@apicovered libusb_init
+@passcase when libusb_init returns LIBUSB_SUCCESS
+@failcase when libusb_init does not return LIBUSB_SUCCESS
+@precondition None
+@postcondition None
+*/
+TEST(hal_libusb, init_p)
+{
+ int rv = libusb_init(NULL);
+ EXPECT_EQ(LIBUSB_SUCCESS, rv) << "Initialization failure";
+}
+
+int hotplug_register_cb(struct libusb_context *ctx,
+ struct libusb_device *dev, libusb_hotplug_event event, void *user_data)
+{
+ return 0;
+}
+
+/*
+@testcase hotplug_register_callback_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(jh8801.jung)
+@type auto
+@description Positive, Register hotplug callback
+@apicovered libusb_hotplug_register_callback
+@passcase when libusb_hotplug_register_callback returns LIBUSB_SUCCESS
+@failcase when libusb_hotplug_register_callback does not return LIBUSB_SUCCESS
+@precondition libusb_has_capability must return 1
+@postcondition None
+*/
+TEST(hal_libusb, hotplug_register_callback_p)
+{
+ int rv = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG);
+ EXPECT_EQ(rv, 1) << "Hotplug capability missing";
+
+ rv = libusb_hotplug_register_callback(NULL,
+ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED,
+ LIBUSB_HOTPLUG_NO_FLAGS,
+ LIBUSB_HOTPLUG_MATCH_ANY,
+ LIBUSB_HOTPLUG_MATCH_ANY,
+ LIBUSB_HOTPLUG_MATCH_ANY,
+ hotplug_register_cb, NULL, NULL);
+ EXPECT_EQ(LIBUSB_SUCCESS, rv) << "Callback set failure";
+}
+
+/*
+@testcase hotplug_register_callback_n
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(jh8801.jung)
+@type auto
+@description Negative, Register hotplug callback
+@apicovered libusb_hotplug_register_callback
+@passcase when libusb_hotplug_register_callback returns LIBUSB_ERROR_INVALID_PARAM
+@failcase when libusb_hotplug_register_callback does not return LIBUSB_ERROR_INVALID_PARAM
+@precondition libusb_has_capability must return 1
+@postcondition None
+*/
+TEST(hal_libusb, hotplug_register_callback_n)
+{
+ int rv = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG);
+ EXPECT_EQ(rv, 1) << "Hotplug capability missing";
+
+ rv = libusb_hotplug_register_callback(NULL,
+ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED,
+ LIBUSB_HOTPLUG_NO_FLAGS,
+ LIBUSB_HOTPLUG_MATCH_ANY,
+ LIBUSB_HOTPLUG_MATCH_ANY,
+ LIBUSB_HOTPLUG_MATCH_ANY,
+ NULL, NULL, NULL);
+ EXPECT_EQ(LIBUSB_ERROR_INVALID_PARAM, rv);
+}
+
+/*
+@testcase Init_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(jh8801.jung)
+@type auto
+@description Positive, Initialize libmtp and detect raw devices
+@apicovered LIBMTP_Init, LIBMTP_Detect_Raw_Devices
+@passcase when LIBMTP_Detect_Raw_Devices returns LIBMTP_ERROR_NONE
+@failcase when LIBMTP_Detect_Raw_Devices does not return LIBMTP_ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(hal_libmtp, Init_p)
+{
+ LIBMTP_raw_device_t *rawdevices;
+ int numrawdevices = 0;
+
+ LIBMTP_Init();
+ int rv = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices);
+ EXPECT_NE(LIBMTP_ERROR_NONE, rv) << "Initialization and Detected"
+ " devices successfully";
+ if (rawdevices) {
+ free(rawdevices);
+ rawdevices = NULL;
+ }
+}
+
+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;
+}
+++ /dev/null
-/*
- * 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 <libusb.h>
-#include <libmtp.h>
-
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-
-/*
-@testcase init_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(jh8801.jung)
-@type auto
-@description Positive, Initialize libusb
-@apicovered libusb_init
-@passcase when libusb_init returns LIBUSB_SUCCESS
-@failcase when libusb_init does not return LIBUSB_SUCCESS
-@precondition None
-@postcondition None
-*/
-TEST(hal_libusb, init_p)
-{
- int rv = libusb_init(NULL);
- EXPECT_EQ(LIBUSB_SUCCESS, rv) << "Initialization failure";
-}
-
-int hotplug_register_cb(struct libusb_context *ctx,
- struct libusb_device *dev, libusb_hotplug_event event, void *user_data)
-{
- return 0;
-}
-
-/*
-@testcase hotplug_register_callback_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(jh8801.jung)
-@type auto
-@description Positive, Register hotplug callback
-@apicovered libusb_hotplug_register_callback
-@passcase when libusb_hotplug_register_callback returns LIBUSB_SUCCESS
-@failcase when libusb_hotplug_register_callback does not return LIBUSB_SUCCESS
-@precondition libusb_has_capability must return 1
-@postcondition None
-*/
-TEST(hal_libusb, hotplug_register_callback_p)
-{
- int rv = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG);
- EXPECT_EQ(rv, 1) << "Hotplug capability missing";
-
- rv = libusb_hotplug_register_callback(NULL,
- LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED,
- LIBUSB_HOTPLUG_NO_FLAGS,
- LIBUSB_HOTPLUG_MATCH_ANY,
- LIBUSB_HOTPLUG_MATCH_ANY,
- LIBUSB_HOTPLUG_MATCH_ANY,
- hotplug_register_cb, NULL, NULL);
- EXPECT_EQ(LIBUSB_SUCCESS, rv) << "Callback set failure";
-}
-
-/*
-@testcase hotplug_register_callback_n
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(jh8801.jung)
-@type auto
-@description Negative, Register hotplug callback
-@apicovered libusb_hotplug_register_callback
-@passcase when libusb_hotplug_register_callback returns LIBUSB_ERROR_INVALID_PARAM
-@failcase when libusb_hotplug_register_callback does not return LIBUSB_ERROR_INVALID_PARAM
-@precondition libusb_has_capability must return 1
-@postcondition None
-*/
-TEST(hal_libusb, hotplug_register_callback_n)
-{
- int rv = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG);
- EXPECT_EQ(rv, 1) << "Hotplug capability missing";
-
- rv = libusb_hotplug_register_callback(NULL,
- LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED,
- LIBUSB_HOTPLUG_NO_FLAGS,
- LIBUSB_HOTPLUG_MATCH_ANY,
- LIBUSB_HOTPLUG_MATCH_ANY,
- LIBUSB_HOTPLUG_MATCH_ANY,
- NULL, NULL, NULL);
- EXPECT_EQ(LIBUSB_ERROR_INVALID_PARAM, rv);
-}
-
-/*
-@testcase Init_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(jh8801.jung)
-@type auto
-@description Positive, Initialize libmtp and detect raw devices
-@apicovered LIBMTP_Init, LIBMTP_Detect_Raw_Devices
-@passcase when LIBMTP_Detect_Raw_Devices returns LIBMTP_ERROR_NONE
-@failcase when LIBMTP_Detect_Raw_Devices does not return LIBMTP_ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(hal_libmtp, Init_p)
-{
- LIBMTP_raw_device_t *rawdevices;
- int numrawdevices = 0;
-
- LIBMTP_Init();
- int rv = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices);
- EXPECT_NE(LIBMTP_ERROR_NONE, rv) << "Initialization and Detected"
- " devices successfully";
- if (rawdevices) {
- free(rawdevices);
- rawdevices = NULL;
- }
-}
-
-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;
-}