From a335b0373d72054ebcd3f3d989b406bdd4d0ddf9 Mon Sep 17 00:00:00 2001 From: Michal Michalski Date: Tue, 30 Jul 2019 11:30:12 +0200 Subject: [PATCH] [tests][common][webapi-plugins.spec] Changed common unit tests files structure. New structure allows better modularization of unit tests. [Verification] webapi_common_tests are built successfully and pass. Signed-off-by: Michal Michalski Change-Id: Icad5cca7739716bde7c09092f4d1d73fca1972a0 --- packaging/webapi-plugins.spec | 4 ++-- src/common/common_ut.gyp | 5 +++-- src/common/ut/{bundle_ut.cc => json-utils.cc} | 8 ++------ src/common/ut/json-utils.h | 22 ++++++++++++++++++++++ src/common/ut/main.cc | 27 +++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 10 deletions(-) rename src/common/ut/{bundle_ut.cc => json-utils.cc} (98%) create mode 100644 src/common/ut/json-utils.h create mode 100644 src/common/ut/main.cc diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 6733b91..8af0459 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -1201,7 +1201,7 @@ mkdir -p %{buildroot}%{crosswalk_extensions_path}/mobile # tizen ut mobile %if "%{?tizen_ut_build}" == "1" mkdir -p %{buildroot}/usr/bin -install -p -m 755 out/bin_mobile/bundle_ut %{buildroot}/usr/bin/ +install -p -m 755 out/bin_mobile/webapi_common_tests %{buildroot}/usr/bin/ %endif install -p -m 644 out/bin_mobile/libtizen*.so %{buildroot}%{crosswalk_extensions_path}/mobile @@ -1339,7 +1339,7 @@ fi # UT files %if "%{?tizen_ut_build}" == "1" %license GTEST.BSD-3-Clause -/usr/bin/bundle_ut +/usr/bin/webapi_common_tests %endif # mobile-extension-emulator diff --git a/src/common/common_ut.gyp b/src/common/common_ut.gyp index 1ceb42f..61db8ad 100644 --- a/src/common/common_ut.gyp +++ b/src/common/common_ut.gyp @@ -4,7 +4,7 @@ ], 'targets': [ { - 'target_name': 'bundle_ut', + 'target_name': 'webapi_common_tests', 'type': 'executable', 'dependencies': [ 'common.gyp:tizen_common' @@ -19,7 +19,8 @@ '../googletest/src/gtest-all.cc', '../googlemock/src/gmock-all.cc', 'ut/common_ut_extension.cc', - 'ut/bundle_ut.cc' + 'ut/json-utils.cc', + 'ut/main.cc' ], 'libraries': [ '-lbundle', diff --git a/src/common/ut/bundle_ut.cc b/src/common/ut/json-utils.cc similarity index 98% rename from src/common/ut/bundle_ut.cc rename to src/common/ut/json-utils.cc index 0155d4d..935b776 100644 --- a/src/common/ut/bundle_ut.cc +++ b/src/common/ut/json-utils.cc @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "tizen.h" - #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "common/ut/json-utils.h" + #include "bundle.h" #include "bundle_internal.h" #include "common/json-utils.h" @@ -396,7 +396,3 @@ TEST_F(BundleToJsonTest, BytesArrayConversion) { EXPECT_EQ(bytes[2].get(), value[1][2]); } -int main(int argc, char* argv[]) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/src/common/ut/json-utils.h b/src/common/ut/json-utils.h new file mode 100644 index 0000000..653a821 --- /dev/null +++ b/src/common/ut/json-utils.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 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. + */ +#ifndef COMMON_UT_JSON_UTILS_H +#define COMMON_UT_JSON_UTILS_H + +class JsonToBundleTest; +class BundleToJsonTest; + +#endif // COMMON_UT_JSON_UTILS_H diff --git a/src/common/ut/main.cc b/src/common/ut/main.cc new file mode 100644 index 0000000..044ac9f --- /dev/null +++ b/src/common/ut/main.cc @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 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 "gtest/gtest.h" + +#include "common/ut/json-utils.h" + +#include "tizen.h" + +int main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + -- 2.7.4