From d88819cde85d5c7e9688346abfc3a2d129c4a7f5 Mon Sep 17 00:00:00 2001 From: posial Date: Fri, 23 Oct 2015 15:44:57 +0200 Subject: [PATCH] Prepare running unit tests [Issue] https://bugs.tizen.org/jira/browse/TT-166 [Problem] When running unit tests segfault occurs and could not start browser [Solution] Remove unneeded files and disable corrupted test. [Verification] Build and run unit tests. Note that still there are some failing cases. Change-Id: If89a56e79015a29418974d6da012824245ec892c --- packaging/org.tizen.browser.spec | 4 - unit_tests/CMakeLists.txt | 4 +- unit_tests/Services/CMakeLists.txt | 81 ------------ unit_tests/Services/DirectAccess.cpp | 95 -------------- unit_tests/Services/IndirectAccess.cpp | 89 ------------- unit_tests/Services/ServiceInterface.cpp | 27 ---- unit_tests/Services/ServiceInterface.h | 34 ----- unit_tests/Services/TestServiceOne/CMakeLists.txt | 19 --- .../Services/TestServiceOne/TestServiceOne.cpp | 49 -------- .../Services/TestServiceOne/TestServiceOne.h | 47 ------- unit_tests/Services/TestServiceTwo/CMakeLists.txt | 19 --- .../Services/TestServiceTwo/TestServiceTwo.cpp | 49 -------- .../Services/TestServiceTwo/TestServiceTwo.h | 47 ------- unit_tests/ut_Action.cpp | 22 ++++ unit_tests/ut_BookmarkItem.cpp | 11 +- unit_tests/ut_Config.cpp | 26 +++- unit_tests/ut_FavoriteService.cpp | 30 +++-- unit_tests/ut_PlatformInputManager.cpp | 8 +- unit_tests/ut_SessionStorage.cpp | 25 +++- unit_tests/ut_StorageService.cpp | 9 +- unit_tests/ut_WebKitEngineService.cpp | 139 ++++++++++++++++----- unit_tests/ut_coreService.cpp | 18 ++- unit_tests/ut_logger.cpp | 9 ++ 23 files changed, 233 insertions(+), 628 deletions(-) delete mode 100644 unit_tests/Services/CMakeLists.txt delete mode 100644 unit_tests/Services/DirectAccess.cpp delete mode 100644 unit_tests/Services/IndirectAccess.cpp delete mode 100644 unit_tests/Services/ServiceInterface.cpp delete mode 100644 unit_tests/Services/ServiceInterface.h delete mode 100644 unit_tests/Services/TestServiceOne/CMakeLists.txt delete mode 100644 unit_tests/Services/TestServiceOne/TestServiceOne.cpp delete mode 100644 unit_tests/Services/TestServiceOne/TestServiceOne.h delete mode 100644 unit_tests/Services/TestServiceTwo/CMakeLists.txt delete mode 100644 unit_tests/Services/TestServiceTwo/TestServiceTwo.cpp delete mode 100644 unit_tests/Services/TestServiceTwo/TestServiceTwo.h diff --git a/packaging/org.tizen.browser.spec b/packaging/org.tizen.browser.spec index 7fd35cf..d131e9c 100644 --- a/packaging/org.tizen.browser.spec +++ b/packaging/org.tizen.browser.spec @@ -115,9 +115,6 @@ chmod -R 660 /opt/usr/data/webkit %defattr(-,root,root,-) %{_appdir}/bin/browser %{_appdir}/res/edje/*/*.edj -%if %BUILD_UT == "ON" -%exclude %{_appdir}/services/libTestService* -%endif %{_appdir}/services/* %{_appdir}/lib/* %defattr(-,app,app,-) @@ -137,6 +134,5 @@ BrowserAPP Unit Tests. %files ut %defattr(-,root,root,-) %{_appdir}/bin/browser-ut -%{_appdir}/services/libTestService* %endif diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 2f95cd9..febe51d 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -1,7 +1,6 @@ project(browser-ut) cmake_minimum_required(VERSION 2.8) -add_subdirectory(Services) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) include(Coreheaders) @@ -31,8 +30,7 @@ set(UNIT_TESTS_SRCS ut_StorageService.cpp ut_coreService.cpp ut_SessionStorage.cpp - Services/ServiceInterface.cpp - ut_WebKitEngineService.cpp +# ut_WebKitEngineService.cpp ) if(TIZEN_BUILD) diff --git a/unit_tests/Services/CMakeLists.txt b/unit_tests/Services/CMakeLists.txt deleted file mode 100644 index 815a7ad..0000000 --- a/unit_tests/Services/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -project(ServicesTest) - -add_subdirectory(TestServiceOne) -add_subdirectory(TestServiceTwo) - -#include(Coreheaders) - - - - - - - - - - - - - -####### INDIRECT ACCESS ########################### -#add_executable(indirectAccess ServiceInterface.cpp IndirectAccess.cpp) - -#add_dependencies(indirectAccess ServiceManager) -#add_dependencies(indirectAccess logger) -#add_dependencies(indirectAccess Config) - -#target_link_libraries(indirectAccess browserCore) - -#install(TARGETS indirectAccess RUNTIME DESTINATION bin) -######## END INDIRECT ACCESS ####################### - - - - - - - - - - - - - - - -####### DIRECT ACCESS ############################## -#add_executable(directAccess ServiceInterface.cpp DirectAccess.cpp) -#add_dependencies(directAccess ServiceManager) -#add_dependencies(directAccess logger) -#add_dependencies(directAccess Config) -#add_dependencies(directAccess TestServiceTwo) - -#target_link_libraries(directAccess browserCore) - -# TestServiceTwo is accessed directly so it requires linking -#target_link_libraries(directAccess TestServiceTwo) - -#install(TARGETS directAccess RUNTIME DESTINATION bin) -####### END DIRECT ACCESS ########################### - - - - - - - - - - - - - - - - - - - - - - diff --git a/unit_tests/Services/DirectAccess.cpp b/unit_tests/Services/DirectAccess.cpp deleted file mode 100644 index 6575fbb..0000000 --- a/unit_tests/Services/DirectAccess.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014 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 -#include - -#include "BrowserLogger.h" - -// for tests... -#include "Lifecycle.h" -#include "ServiceManager.h" - - -//Direct access requires service headers -#include "TestServiceTwo/TestServiceTwo.h" - -int main() try -{ - BEGIN() -#ifndef NDEBUG - //Initialization of logger module - tizen_browser::logger::Logger::getInstance().init(); - tizen_browser::logger::Logger::getInstance().setLogTag("DirectAccess Test"); -#endif - BROWSER_LOGD("BROWSER IS SAYING HELLO"); - //get the ServiceManager - tizen_browser::core::ServiceManager *svm = &tizen_browser::core::ServiceManager::getInstance(); - - //Sevice1 we will access indirectly - ///\todo: simplify casting! - std::shared_ptr service1 - = std::dynamic_pointer_cast - < - ServiceInterface,//casting to ServiceInterface - tizen_browser::core::AbstractService - > - (svm->getService("org.tizen.browser.TestServiceOne")); - - //Service2 we will access directly - std::shared_ptr service2 - = std::dynamic_pointer_cast - < - TestServiceTwo,//casting directly to explicit service - tizen_browser::core::AbstractService - > - (svm->getService("org.tizen.browser.TestServiceTwo")); - - if(service1){ - BROWSER_LOGD(service1->getName().c_str() ); - BROWSER_LOGD("%p" , service1.get() ); - service1->isRunning(); - - service1->isRunning(); - service1->run(); - service1->isRunning(); - service1->stop(); - service1->isRunning(); - } - - - if(service2){ - BROWSER_LOGD(service2->getName().c_str() ); - BROWSER_LOGD("%p", service2.get() ); - service2->isRunning(); - - service2->isRunning(); - service2->run(); - service2->isRunning(); - service2->stop(); - service2->isRunning(); - } - - END() - -} catch (std::exception & e) -{ - std::cerr << "UNHANDLED EXCEPTION " << e.what() << std::endl; -} catch (...) -{ - std::cerr << "UNHANDLED EXCEPTION" << std::endl; -} - diff --git a/unit_tests/Services/IndirectAccess.cpp b/unit_tests/Services/IndirectAccess.cpp deleted file mode 100644 index 58537c9..0000000 --- a/unit_tests/Services/IndirectAccess.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2014 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 -#include "BrowserLogger.h" - -// for tests... -#include "Lifecycle.h" -#include "ServiceManager.h" -#include "ServiceInterface.h" - - -int main() try -{ - BEGIN() -#ifndef NDEBUG - //Initialization of logger module - tizen_browser::logger::Logger::getInstance().init(); - tizen_browser::logger::Logger::getInstance().setLogTag("IndirectAccess.cpp"); -#endif - BROWSER_LOGD("BROWSER IS SAYING HELLO"); - tizen_browser::core::ServiceManager *svm = &tizen_browser::core::ServiceManager::getInstance(); - - - - std::shared_ptr service1 - = std::dynamic_pointer_cast - < - ServiceInterface, - tizen_browser::core::AbstractService - > - (svm->getService("org.tizen.browser.TestServiceOne")); - - - - std::shared_ptr service2 - = std::dynamic_pointer_cast - < - ServiceInterface, - tizen_browser::core::AbstractService - > - (svm->getService("org.tizen.browser.TestServiceTwo")); - - if(service1){ - BROWSER_LOGD(service1->getName().c_str()); - BROWSER_LOGD("%p", service1.get() ); - service1->isRunning(); - - service1->isRunning(); - service1->run(); - service1->isRunning(); - service1->stop(); - service1->isRunning(); - } - if(service2){ - BROWSER_LOGD(service2->getName().c_str() ); - BROWSER_LOGD("%p" , service2.get() ); - service2->isRunning(); - - service2->isRunning(); - service2->run(); - service2->isRunning(); - service2->stop(); - service2->isRunning(); - } - - END() - -} catch (std::exception & e) -{ - std::cerr << "UNHANDLED EXCEPTION " << e.what() << std::endl ; -} catch (...) -{ - std::cerr << "UNHANDLED EXCEPTION" << std::endl; -} - diff --git a/unit_tests/Services/ServiceInterface.cpp b/unit_tests/Services/ServiceInterface.cpp deleted file mode 100644 index 3d41a4a..0000000 --- a/unit_tests/Services/ServiceInterface.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014 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 "ServiceInterface.h" - -ServiceInterface::ServiceInterface() -{ - -} - -ServiceInterface::~ServiceInterface() -{ - -} diff --git a/unit_tests/Services/ServiceInterface.h b/unit_tests/Services/ServiceInterface.h deleted file mode 100644 index 1893e3e..0000000 --- a/unit_tests/Services/ServiceInterface.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef SERVICEINTERFACE_H -#define SERVICEINTERFACE_H - -#include "AbstractService.h" -#include "ServiceFactory.h" -#include "service_macros.h" - -class ServiceInterface : public tizen_browser::core::AbstractService -{ -public: - ServiceInterface(); - virtual ~ServiceInterface(); - virtual void run() = 0; - virtual void stop() = 0 ; - virtual bool isRunning() = 0; -}; - -#endif // SERVICEINTERFACE_H diff --git a/unit_tests/Services/TestServiceOne/CMakeLists.txt b/unit_tests/Services/TestServiceOne/CMakeLists.txt deleted file mode 100644 index bae3bb3..0000000 --- a/unit_tests/Services/TestServiceOne/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -project(TestServiceOne) - -set(TestServiceOne_SRCS - TestServiceOne.cpp - ) - -set(TestServiceOne_HEDS - TestServiceOne.h - ) - -include(Coreheaders) - - -add_library(${PROJECT_NAME} SHARED ${TestServiceOne_SRCS}) - - -install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION services - ARCHIVE DESTINATION services/static) diff --git a/unit_tests/Services/TestServiceOne/TestServiceOne.cpp b/unit_tests/Services/TestServiceOne/TestServiceOne.cpp deleted file mode 100644 index 85d5572..0000000 --- a/unit_tests/Services/TestServiceOne/TestServiceOne.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 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 "TestServiceOne.h" -#include "service_macros.h" -#include "boost/test/unit_test.hpp" - - -TestServiceOne::TestServiceOne() - : m_isRunning(false) -{ - -} - -TestServiceOne::~TestServiceOne() -{ - BOOST_TEST_MESSAGE(__PRETTY_FUNCTION__); -} - -bool TestServiceOne::isRunning() -{ - BOOST_TEST_MESSAGE(std::string(__PRETTY_FUNCTION__) + "->" + (m_isRunning ? "true": "false")); - return m_isRunning; -} - -void TestServiceOne::run() -{ - BOOST_TEST_MESSAGE(__PRETTY_FUNCTION__); - m_isRunning=true; -} - -void TestServiceOne::stop() -{ - BOOST_TEST_MESSAGE(__PRETTY_FUNCTION__); - m_isRunning=false; -} diff --git a/unit_tests/Services/TestServiceOne/TestServiceOne.h b/unit_tests/Services/TestServiceOne/TestServiceOne.h deleted file mode 100644 index a5ee6a3..0000000 --- a/unit_tests/Services/TestServiceOne/TestServiceOne.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef TESTMASTER_H -#define TESTMASTER_H - -#include - -#include "AbstractService.h" -#include "ServiceFactory.h" -#include "service_macros.h" -#include "../ServiceInterface.h" -#include "Lifecycle.h" - - -class BROWSER_EXPORT TestServiceOne : public ServiceInterface , ShowLifeCycle -{ -public: - TestServiceOne(); - //TestMaster(const AbstractService::AgrsMap& args); - virtual ~TestServiceOne(); - void run(); - void stop(); - bool isRunning(); - virtual std::string getName(); -private: - bool m_isRunning; -}; - - -EXPORT_SERVICE(TestServiceOne, "org.tizen.browser.TestServiceOne") - - -#endif // TESTMASTER_H diff --git a/unit_tests/Services/TestServiceTwo/CMakeLists.txt b/unit_tests/Services/TestServiceTwo/CMakeLists.txt deleted file mode 100644 index 8763ba3..0000000 --- a/unit_tests/Services/TestServiceTwo/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -project(TestServiceTwo) - -set(TestServiceTwo_SRCS - TestServiceTwo.cpp - ) - -set(TestServiceTwo_HEDS - TestServiceTwo.h - ) - -include(Coreheaders) - - -add_library(${PROJECT_NAME} SHARED ${TestServiceTwo_SRCS}) - - -install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION services - ARCHIVE DESTINATION services/static) diff --git a/unit_tests/Services/TestServiceTwo/TestServiceTwo.cpp b/unit_tests/Services/TestServiceTwo/TestServiceTwo.cpp deleted file mode 100644 index 8a123ae..0000000 --- a/unit_tests/Services/TestServiceTwo/TestServiceTwo.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 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 "TestServiceTwo.h" -#include "service_macros.h" -#include - -TestServiceTwo::TestServiceTwo() - : m_isRunning(false) -{ - -} - -TestServiceTwo::~TestServiceTwo() -{ - BOOST_TEST_MESSAGE(__PRETTY_FUNCTION__); -} - -bool TestServiceTwo::isRunning() -{ - BOOST_TEST_MESSAGE(std::string(__PRETTY_FUNCTION__) + "->" + (m_isRunning ? "true": "false")); - return m_isRunning; -} - -void TestServiceTwo::run() -{ - BOOST_TEST_MESSAGE(__PRETTY_FUNCTION__); - m_isRunning=true; -} - -void TestServiceTwo::stop() -{ - BOOST_TEST_MESSAGE(__PRETTY_FUNCTION__); - m_isRunning=false; -} diff --git a/unit_tests/Services/TestServiceTwo/TestServiceTwo.h b/unit_tests/Services/TestServiceTwo/TestServiceTwo.h deleted file mode 100644 index adbf102..0000000 --- a/unit_tests/Services/TestServiceTwo/TestServiceTwo.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef TESTMASTER_H -#define TESTMASTER_H - -#include - -#include "AbstractService.h" -#include "ServiceFactory.h" -#include "service_macros.h" -#include "../ServiceInterface.h" -#include "Lifecycle.h" - - -class BROWSER_EXPORT TestServiceTwo : public ServiceInterface, ShowLifeCycle -{ -public: - TestServiceTwo(); - //TestMaster(const AbstractService::AgrsMap& args); - virtual ~TestServiceTwo(); - void run(); - void stop(); - bool isRunning(); - virtual std::string getName(); -private: - bool m_isRunning; -}; - - -EXPORT_SERVICE(TestServiceTwo, "org.tizen.browser.TestServiceTwo") - - -#endif // TESTMASTER_H diff --git a/unit_tests/ut_Action.cpp b/unit_tests/ut_Action.cpp index 597bbe0..093cf49 100644 --- a/unit_tests/ut_Action.cpp +++ b/unit_tests/ut_Action.cpp @@ -21,11 +21,15 @@ #include #include "Action.h" +#include "BrowserLogger.h" + BOOST_AUTO_TEST_SUITE(action) BOOST_AUTO_TEST_CASE(action_constructors) { + BROWSER_LOGI("[UT] Action - action_constructor - START --> "); + tizen_browser::base_ui::Action action_01; BOOST_CHECK_EQUAL(action_01.isEnabled(), true); BOOST_CHECK_EQUAL(action_01.isCheckable(), false); @@ -58,9 +62,12 @@ BOOST_AUTO_TEST_CASE(action_constructors) BOOST_CHECK_EQUAL(action_04.getText(), a04_text); BOOST_CHECK_EQUAL(action_04.getIcon(), a04_icon); + BROWSER_LOGI("[UT] --> END - Action - action_constructor"); } + BOOST_AUTO_TEST_CASE(action_get_and_set){ + BROWSER_LOGI("[UT] Action - action_get_and_set - START --> "); std::string iconText("iconText"); std::string text("text"); @@ -87,10 +94,14 @@ BOOST_AUTO_TEST_CASE(action_get_and_set){ BOOST_CHECK_EQUAL(action.getIcon(), icon); BOOST_CHECK_EQUAL(action.getSelIcon(), selIcon); BOOST_CHECK_EQUAL(action.getDisIcon(), disIcon); + + BROWSER_LOGI("[UT] --> END - Action - action_get_and_set"); } BOOST_AUTO_TEST_CASE(action_bool_behaviour){ + BROWSER_LOGI("[UT] Action - action_bool_behaviour - START --> "); + tizen_browser::base_ui::Action action_01; //action is not checkable by defalut, //this call should be ignored. @@ -108,9 +119,13 @@ BOOST_AUTO_TEST_CASE(action_bool_behaviour){ action_02.toggle(); BOOST_CHECK_EQUAL(action_02.isChecked(), false); + BROWSER_LOGI("[UT] --> END - Action - action_bool_behaviour"); } BOOST_AUTO_TEST_CASE(action_trigger_test){ + + BROWSER_LOGI("[UT] Action - action_trigger_test - START --> "); + struct TriggerHandler{ TriggerHandler() :beenCalled(false){}; @@ -130,9 +145,14 @@ BOOST_AUTO_TEST_CASE(action_trigger_test){ action_01.triggered.connect(boost::ref(triggered)); action_01.trigger(); BOOST_CHECK_EQUAL(triggered.beenCalled, true); + + BROWSER_LOGI("[UT] --> END - Action - action_trigger_test"); } BOOST_AUTO_TEST_CASE(action_togle_test){ + + BROWSER_LOGI("[UT] Action - action_togle_test - START --> "); + struct ToggleHandler{ ToggleHandler() :isChecked(false),beenCalled(false){}; @@ -155,6 +175,8 @@ BOOST_AUTO_TEST_CASE(action_togle_test){ action.toggle(); BOOST_CHECK_EQUAL(toggelHandler.beenCalled, true); BOOST_CHECK_EQUAL(action.isChecked(), toggelHandler.isChecked); + + BROWSER_LOGI("[UT] --> END - Action - action_togle_test"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_BookmarkItem.cpp b/unit_tests/ut_BookmarkItem.cpp index 5c8c7ad..b5336a3 100644 --- a/unit_tests/ut_BookmarkItem.cpp +++ b/unit_tests/ut_BookmarkItem.cpp @@ -27,8 +27,8 @@ BOOST_AUTO_TEST_SUITE(bookmark_item) BOOST_AUTO_TEST_CASE(bookm_item_set_get) { - BROWSER_LOGI("BOOKMARK_ITEM_TEST_CASE START --> "); - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + BROWSER_LOGI("[UT] BookmarkItem - bookm_item_set_get - START --> "); + std::string retstr = ""; std::unique_ptr bitem(new tizen_browser::services::BookmarkItem()); @@ -54,11 +54,14 @@ BOOST_AUTO_TEST_CASE(bookm_item_set_get) BOOST_CHECK_EQUAL(0, bitem->getId()); bitem->setId(9999); BOOST_CHECK_EQUAL(9999, bitem->getId()); + + BROWSER_LOGI("[UT] --> END - BookmarkItem - bookm_item_set_get"); } BOOST_AUTO_TEST_CASE(bookm_item_favicon_thumb) { - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + BROWSER_LOGI("[UT] BookmarkItem - bookm_item_favicon_thumb - START --> "); + std::unique_ptr bitem(new tizen_browser::services::BookmarkItem()); std::shared_ptr bimg @@ -78,7 +81,7 @@ BOOST_AUTO_TEST_CASE(bookm_item_favicon_thumb) BOOST_CHECK_EQUAL(10, bitem->getThumbnail()->height); BOOST_CHECK_EQUAL(500, bitem->getThumbnail()->dataSize); - BROWSER_LOGI("<-- BOOKMARK_ITEM_TEST_CASE END"); + BROWSER_LOGI("[UT] --> END - BookmarkItem - bookm_item_favicon_thumb"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_Config.cpp b/unit_tests/ut_Config.cpp index e9233ea..447507a 100644 --- a/unit_tests/ut_Config.cpp +++ b/unit_tests/ut_Config.cpp @@ -30,10 +30,14 @@ #include "BrowserLogger.h" #include "Config.h" +#define TAG "[UT] Config - " + BOOST_AUTO_TEST_SUITE(config) BOOST_AUTO_TEST_CASE(config_simple_get_set) { + BROWSER_LOGI(TAG "config_simple_get_set - START --> "); + std::unique_ptr defconf(new tizen_browser::config::DefaultConfig()); BOOST_CHECK(defconf); @@ -44,6 +48,8 @@ BOOST_AUTO_TEST_CASE(config_simple_get_set) defconf->set("intTestKey", testval); int retval = boost::any_cast(defconf->get(std::string("intTestKey"))); BOOST_CHECK_EQUAL(testval, retval); + + BROWSER_LOGI(TAG "Config - config_simple_get_set"); } /* @@ -51,6 +57,8 @@ BOOST_AUTO_TEST_CASE(config_simple_get_set) */ BOOST_AUTO_TEST_CASE(config_load_store) { + BROWSER_LOGI(TAG "config_load_store - START --> "); + std::unique_ptr configuration1(new tizen_browser::config::DefaultConfig()); std::unique_ptr configuration2(new tizen_browser::config::DefaultConfig()); BOOST_CHECK(&configuration1); @@ -66,12 +74,14 @@ BOOST_AUTO_TEST_CASE(config_load_store) retstring = boost::any_cast(configuration2->get(std::string("userInterface"))); } catch(boost::bad_any_cast & e){ /// \todo Need to resolve bad type (void *) from boost::any(empty_string)) - BROWSER_LOGI("[i] Catched error, msg: %s",e.what()); - BROWSER_LOGI("[i] std::map not found map[key] and returns NULL to boost::any_cast as type (void*) instead of std::string (this case)\n"); + BROWSER_LOGI(TAG "[i] Catched error, msg: %s",e.what()); + BROWSER_LOGI(TAG "[i] std::map not found map[key] and returns NULL to boost::any_cast as type (void*) instead of std::string (this case)\n"); } /// \todo Below test should be enabled when saving and loading to/from config file will be implemented. /// BOOST_CHECK_EQUAL(teststr, retstring); configuration2.reset(); + + BROWSER_LOGI(TAG "--> END - config_load_store"); } @@ -80,6 +90,8 @@ BOOST_AUTO_TEST_CASE(config_load_store) */ BOOST_AUTO_TEST_CASE(config_boundary_conditions) { + BROWSER_LOGI(TAG "config_boundary_conditions - START --> "); + std::unique_ptr configuration(new tizen_browser::config::DefaultConfig()); BOOST_CHECK(&configuration); std::string retstring; @@ -91,8 +103,8 @@ BOOST_AUTO_TEST_CASE(config_boundary_conditions) retany = configuration->get(NULL); } catch(std::logic_error & e){ /// \todo get() function expects string and cannot construct empty string from NULL - BROWSER_LOGI("[i] Catched error, msg: %s",e.what()); - BROWSER_LOGI("[i] get() function expects string and cannot construct empty string from NULL\n"); + BROWSER_LOGI(TAG "[i] Catched error, msg: %s",e.what()); + BROWSER_LOGI(TAG "[i] get() function expects string and cannot construct empty string from NULL\n"); } try{ @@ -100,8 +112,8 @@ BOOST_AUTO_TEST_CASE(config_boundary_conditions) BOOST_CHECK(retstring.empty()); }catch(boost::bad_any_cast & e){ /// \todo Need to resolve bad type (void *) from boost::any(empty_string)) - BROWSER_LOGI("[i] Catched error, msg: %s",e.what()); - BROWSER_LOGI("[i] std::map not found map[key] and returns NULL to boost::any_cast as type (void*) instead of std::string (this case)\n"); + BROWSER_LOGI(TAG "[i] Catched error, msg: %s",e.what()); + BROWSER_LOGI(TAG "[i] std::map not found map[key] and returns NULL to boost::any_cast as type (void*) instead of std::string (this case)\n"); } configuration->set(std::string(""), std::string("value")); retstring = boost::any_cast(configuration->get(std::string(""))); @@ -136,6 +148,8 @@ BOOST_AUTO_TEST_CASE(config_boundary_conditions) retstring = boost::any_cast(configuration->get(std::string("SameTestKey"))); BOOST_CHECK_EQUAL(std::string("valueB"), retstring); BOOST_CHECK_PREDICATE( std::not_equal_to(), (retstring)(std::string("valueA")) ); + + BROWSER_LOGI(TAG "--> END - config_boundary_conditions"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_FavoriteService.cpp b/unit_tests/ut_FavoriteService.cpp index fbaa74b..aab513f 100644 --- a/unit_tests/ut_FavoriteService.cpp +++ b/unit_tests/ut_FavoriteService.cpp @@ -30,6 +30,7 @@ #include "BookmarkService.h" #include "BookmarkItem.h" +#define TAG "[UT] Bookmarks - " BOOST_AUTO_TEST_SUITE(bookmarks) @@ -37,7 +38,8 @@ bool item_is_empty(std::shared_ptr item) BOOST_AUTO_TEST_CASE(bookmark_add_remove) { - BROWSER_LOGI("BOOKMARKS_TEST_CASE START --> "); + BROWSER_LOGI(TAG "bookmark_add_remove - START --> "); + /// \todo: clean casts, depends on ServiceManager std::shared_ptr fs = @@ -59,25 +61,25 @@ BOOST_AUTO_TEST_CASE(bookmark_add_remove) std::vector> bookmarks_list = fs->getBookmarks(); while(!bookmarks_list.empty()) { bitem = bookmarks_list.back(); - BROWSER_LOGI("Element from cached bookmark list: id: %d, tittle: %s, URL: %s", bitem->getId(), + BROWSER_LOGI(TAG "Element from cached bookmark list: id: %d, tittle: %s, URL: %s", bitem->getId(), bitem->getTittle().c_str(), bitem->getAddress().c_str()); bookmarks_list.pop_back(); } - BROWSER_LOGI("Above - current stored bookmarks (recently adder order"); + BROWSER_LOGI(TAG "Above - current stored bookmarks (recently adder order"); // clean all bookmarks resultflag = fs->deleteAllBookmarks(); BOOST_CHECK(resultflag); fs->getBookmarks(); - BROWSER_LOGI("Above - current stored bookmarks after deleteAll, deleting resultflag: %d", resultflag); + BROWSER_LOGI(TAG "Above - current stored bookmarks after deleteAll, deleting resultflag: %d", resultflag); // Empty bookmark test bookcount = fs->countBookmarks(); BOOST_CHECK(item_is_empty(fs->addToBookmarks("",""))); bookcount2 = fs->countBookmarks(); BOOST_CHECK_EQUAL(bookcount, bookcount2); - BROWSER_LOGI("Add empty bookmark test summary - number of bookmarks before: %d, after: %d", bookcount ,bookcount2); + BROWSER_LOGI(TAG "Add empty bookmark test summary - number of bookmarks before: %d, after: %d", bookcount ,bookcount2); fs->getBookmarks(); // Add bookmark with the same tittle @@ -86,28 +88,32 @@ BOOST_AUTO_TEST_CASE(bookmark_add_remove) std::shared_ptr item_to_delete = fs->addToBookmarks("www.thisis.url5","Tittle"); BOOST_CHECK(!item_is_empty(item_to_delete)); fs->getBookmarks(); - BROWSER_LOGI("Before delete last bookmark (%s)", item_to_delete->getAddress().c_str()); + BROWSER_LOGI(TAG "Before delete last bookmark (%s)", item_to_delete->getAddress().c_str()); BOOST_CHECK(fs->deleteBookmark(item_to_delete->getAddress())); - BROWSER_LOGI("After delete bookmark"); + BROWSER_LOGI(TAG "After delete bookmark"); fs->getBookmarks(); // Add duplicated url - BROWSER_LOGI("Add duplicated url"); + BROWSER_LOGI(TAG "Add duplicated url"); BOOST_CHECK(item_is_empty(fs->addToBookmarks("www.thisis.url4","Not duplicateTittle"))); fs->getBookmarks(); // check existing url resultflag = fs->bookmarkExists("www.not_existing.url"); - BROWSER_LOGI("Check not existing url (%s) resultflag: %d", "www.not_existing.url", resultflag); + BROWSER_LOGI(TAG "Check not existing url (%s) resultflag: %d", "www.not_existing.url", resultflag); BOOST_CHECK(!resultflag); resultflag = fs->bookmarkExists("www.thisis.url4"); - BROWSER_LOGI("Check existing url (%s) resultflag: %d", "www.thisis.url4", resultflag); + BROWSER_LOGI(TAG "Check existing url (%s) resultflag: %d", "www.thisis.url4", resultflag); BOOST_CHECK(resultflag); + + BROWSER_LOGI(TAG "--> END - bookmark_add_remove"); } BOOST_AUTO_TEST_CASE(bookmark_synchro) { /// \todo: clean casts, depends on ServiceManager + BROWSER_LOGI(TAG "bookmark_synchro - START --> "); + std::shared_ptr fs = std::dynamic_pointer_cast < @@ -116,11 +122,11 @@ BOOST_AUTO_TEST_CASE(bookmark_synchro) > (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.favoriteservice")); - BROWSER_LOGI("Bookmarks synchronize test"); + BROWSER_LOGI(TAG "Bookmarks synchronize test"); fs->synchronizeBookmarks(); BOOST_CHECK(!fs->getBookmarks().empty()); - BROWSER_LOGI("<-- BOOKMARKS_TEST_CASE END"); + BROWSER_LOGI(TAG "--> END - bookmark_synchro"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_PlatformInputManager.cpp b/unit_tests/ut_PlatformInputManager.cpp index 520c96e..728e0a4 100644 --- a/unit_tests/ut_PlatformInputManager.cpp +++ b/unit_tests/ut_PlatformInputManager.cpp @@ -20,12 +20,16 @@ #include "ServiceManager.h" #include "PlatformInputManager.h" +#include "BrowserLogger.h" + BOOST_AUTO_TEST_SUITE(PlatformInputManager) BOOST_AUTO_TEST_CASE(PointerModeSetting) { - std::shared_ptr platformInputManager = + BROWSER_LOGI("[UT] PlatformInputManager - PointerModeSetting - START --> "); + + std::shared_ptr platformInputManager = std::dynamic_pointer_cast (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.platforminputmanager")); @@ -41,6 +45,8 @@ BOOST_AUTO_TEST_CASE(PointerModeSetting) // platformInputManager->setPointerModeEnabled(true); // // BOOST_CHECK(platformInputManager->getPointerModeEnabled()); + + BROWSER_LOGI("[UT] --> END - PlatformInputManager - PointerModeSetting"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_SessionStorage.cpp b/unit_tests/ut_SessionStorage.cpp index 2651c83..7fb8ba9 100644 --- a/unit_tests/ut_SessionStorage.cpp +++ b/unit_tests/ut_SessionStorage.cpp @@ -25,11 +25,15 @@ #include "services/SessionStorage/Session.h" #include "AbstractWebEngine/TabId.h" #include +#include "BrowserLogger.h" + BOOST_AUTO_TEST_SUITE(SessionStorage) BOOST_AUTO_TEST_CASE(InitSession) { + BROWSER_LOGI("[UT] SessionStorage - InitSession - START --> "); + tizen_browser::config::DefaultConfig config; config.load("not used text"); std::string resourceDbDir(boost::any_cast < std::string > (config.get("resourcedb/dir"))); @@ -52,10 +56,14 @@ BOOST_AUTO_TEST_CASE(InitSession) storage = sessionService->getStorage(); BOOST_REQUIRE(storage); + + BROWSER_LOGI("[UT] --> END - SessionStorage - InitSession"); } BOOST_AUTO_TEST_CASE(CreateAndPopulateSession) { + BROWSER_LOGI("[UT] SessionStorage - CreateAndPopulateSession - START --> "); + std::shared_ptr sessionService = std::dynamic_pointer_cast < @@ -102,10 +110,13 @@ BOOST_AUTO_TEST_CASE(CreateAndPopulateSession) BOOST_CHECK_EQUAL(session.items().size(), 2); + BROWSER_LOGI("[UT] --> END - SessionStorage - CreateAndPopulateSession"); } BOOST_AUTO_TEST_CASE(getLastSession) { + BROWSER_LOGI("[UT] SessionStorage - getLastSession - START --> "); + std::shared_ptr sessionService = std::dynamic_pointer_cast < @@ -152,10 +163,14 @@ BOOST_AUTO_TEST_CASE(getLastSession) ); BOOST_CHECK_EQUAL(lastSession.items().size(), 3); + + BROWSER_LOGI("[UT] --> END - SessionStorage - getLastSession"); } BOOST_AUTO_TEST_CASE(getAllSessions) { + BROWSER_LOGI("[UT] SessionStorage - getAllSessions - START --> "); + std::shared_ptr sessionService = std::dynamic_pointer_cast < @@ -175,12 +190,14 @@ BOOST_AUTO_TEST_CASE(getAllSessions) BOOST_CHECK_EQUAL(sessions.size(), 2); - + BROWSER_LOGI("[UT] --> END - SessionStorage - getAllSessions"); } BOOST_AUTO_TEST_CASE(deleteSession) { + BROWSER_LOGI("[UT] SessionStorage - deleteSession - START --> "); + std::shared_ptr sessionService = std::dynamic_pointer_cast < @@ -203,11 +220,15 @@ BOOST_AUTO_TEST_CASE(deleteSession) tizen_browser::Session::SessionsVector sessionsBucket(storage->getAllSessions()); BOOST_CHECK_EQUAL(sessionsBucket.size(),1); + + BROWSER_LOGI("[UT] --> END - SessionStorage - deleteSession"); } BOOST_AUTO_TEST_CASE(deleteAllSessions) { + BROWSER_LOGI("[UT] SessionStorage - deleteAllSessions - START --> "); + std::shared_ptr sessionService = std::dynamic_pointer_cast < @@ -255,6 +276,8 @@ BOOST_AUTO_TEST_CASE(deleteAllSessions) sessionsBucket = storage->getAllSessions(); BOOST_CHECK_EQUAL(sessionsBucket.size(), 0); + + BROWSER_LOGI("[UT] --> END - SessionStorage - deleteAllSessions"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_StorageService.cpp b/unit_tests/ut_StorageService.cpp index 29987f0..c778a4b 100644 --- a/unit_tests/ut_StorageService.cpp +++ b/unit_tests/ut_StorageService.cpp @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_SUITE(StorageService) BOOST_AUTO_TEST_CASE(storage_settings) { - BROWSER_LOGI("StorageService - history - START --> "); + BROWSER_LOGI("[UT] StorageService - storage_settings - START --> "); std::shared_ptr storageManager = std::dynamic_pointer_cast < tizen_browser::services::StorageService, @@ -107,13 +107,12 @@ BOOST_AUTO_TEST_CASE(storage_settings) auto sString = storageManager->getSettingsText(keyString, "0.0"); BOOST_CHECK("String" == sString); - - BROWSER_LOGI("<-- StorageService - history - END"); + BROWSER_LOGI("[UT] --> END - StorageService - storage_settings"); } BOOST_AUTO_TEST_CASE(storage_bookmark) { - BROWSER_LOGI("StorageService - bookmark - START --> "); + BROWSER_LOGI("[UT] StorageService - storage_bookmark - START --> "); std::shared_ptr storageManager = std::dynamic_pointer_cast < tizen_browser::services::StorageService, @@ -137,7 +136,7 @@ BOOST_AUTO_TEST_CASE(storage_bookmark) storageManager->deleteThumbnail(1);*/ - BROWSER_LOGI("<-- StorageService - bookmark - END"); + BROWSER_LOGI("[UT] --> END - StorageService - storage_bookmark"); } // Should it be moved to ut_historyService ???? diff --git a/unit_tests/ut_WebKitEngineService.cpp b/unit_tests/ut_WebKitEngineService.cpp index 7e3d489..57f4cea 100644 --- a/unit_tests/ut_WebKitEngineService.cpp +++ b/unit_tests/ut_WebKitEngineService.cpp @@ -15,14 +15,29 @@ */ #include +#include +#include #include "ServiceManager.h" #include "AbstractWebEngine.h" +#include "BrowserLogger.h" + +#define TAG "[UT] WebKitEngine - " + BOOST_AUTO_TEST_SUITE(WebKitEngineService) +BOOST_AUTO_TEST_CASE(EwkInit) +{ + BROWSER_LOGI(TAG "EwkInit - START --> "); + BOOST_REQUIRE(ewk_init() > 0); + BROWSER_LOGI(TAG "--> END - EwkInit"); +} + BOOST_AUTO_TEST_CASE(UriSetGet) { + BROWSER_LOGI(TAG "UriSetGet - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -30,7 +45,14 @@ BOOST_AUTO_TEST_CASE(UriSetGet) BOOST_CHECK(webkitEngineService); - webkitEngineService->init(NULL); +// elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); +// Evas_Object *main_window = elm_win_util_standard_add("browserApp-ut", "browserApp-ut"); +// if (main_window == nullptr) +// BROWSER_LOGE(TAG "Failed to create main window"); +// elm_win_autodel_set(main_window, EINA_TRUE); + Evas_Object *main_window = nullptr; + + webkitEngineService->init(main_window); tizen_browser::basic_webengine::TabId parentTabId = webkitEngineService->addTab("www.test.com"); @@ -39,15 +61,19 @@ BOOST_AUTO_TEST_CASE(UriSetGet) webkitEngineService->setURI("www.test2.com"); // URIs are different because of WebKit didn't load webpage (lack of initialization) - BOOST_TEST_MESSAGE("Print getURI():" << webkitEngineService->getURI()); + BOOST_TEST_MESSAGE(TAG "Print getURI():" << webkitEngineService->getURI()); - BOOST_TEST_MESSAGE("Print getTitle():" << webkitEngineService->getTitle()); + BOOST_TEST_MESSAGE(TAG "Print getTitle():" << webkitEngineService->getTitle()); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - UriSetGet"); } BOOST_AUTO_TEST_CASE(NavigationTest) { + BROWSER_LOGI(TAG "NavigationTest - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -65,21 +91,25 @@ BOOST_AUTO_TEST_CASE(NavigationTest) webkitEngineService->setURI("www.nextpage.com"); - BOOST_TEST_MESSAGE("Is back enabled: " << webkitEngineService->isBackEnabled()); + BOOST_TEST_MESSAGE(TAG "Is back enabled: " << webkitEngineService->isBackEnabled()); webkitEngineService->back(); - BOOST_TEST_MESSAGE("Is forward enabled: " << webkitEngineService->isForwardEnabled()); + BOOST_TEST_MESSAGE(TAG "Is forward enabled: " << webkitEngineService->isForwardEnabled()); webkitEngineService->forward(); - BOOST_TEST_MESSAGE("Is loading: " << webkitEngineService->isLoading()); + BOOST_TEST_MESSAGE(TAG "Is loading: " << webkitEngineService->isLoading()); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - NavigationTest"); } BOOST_AUTO_TEST_CASE(ClearPrivateData) { + BROWSER_LOGI(TAG "ClearPrivateData - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -91,11 +121,15 @@ BOOST_AUTO_TEST_CASE(ClearPrivateData) webkitEngineService->clearPrivateData(); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - ClearPrivateData"); } BOOST_AUTO_TEST_CASE(TabsCreationDeletion) { + BROWSER_LOGI(TAG "TabsCreationDeletion - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -103,7 +137,7 @@ BOOST_AUTO_TEST_CASE(TabsCreationDeletion) BOOST_CHECK(webkitEngineService); - BOOST_TEST_MESSAGE("Tabs count: " << webkitEngineService->tabsCount()); + BOOST_TEST_MESSAGE(TAG "Tabs count: " << webkitEngineService->tabsCount()); tizen_browser::basic_webengine::TabId first = webkitEngineService->addTab("www.first.com"); @@ -113,17 +147,21 @@ BOOST_AUTO_TEST_CASE(TabsCreationDeletion) BOOST_CHECK(webkitEngineService->tabsCount() == 2); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab(first)); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab(first)); BOOST_CHECK(webkitEngineService->tabsCount() == 1); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab(second)); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab(second)); BOOST_CHECK(!(webkitEngineService->tabsCount())); + + BROWSER_LOGI(TAG "--> END - TabsCreationDeletion"); } BOOST_AUTO_TEST_CASE(TabsSwitching) { + BROWSER_LOGI(TAG "TabsSwitching - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -131,12 +169,12 @@ BOOST_AUTO_TEST_CASE(TabsSwitching) BOOST_CHECK(webkitEngineService); - BOOST_TEST_MESSAGE("Tabs count: " << webkitEngineService->tabsCount()); + BOOST_TEST_MESSAGE(TAG "Tabs count: " << webkitEngineService->tabsCount()); - BOOST_TEST_MESSAGE("Initial current tab: " << webkitEngineService->currentTabId().toString()); + BOOST_TEST_MESSAGE(TAG "Initial current tab: " << webkitEngineService->currentTabId().toString()); tizen_browser::basic_webengine::TabId first = webkitEngineService->addTab("www.first.com"); - BOOST_TEST_MESSAGE("First tab: " << first.toString()); + BOOST_TEST_MESSAGE(TAG "First tab: " << first.toString()); webkitEngineService->switchToTab(first); @@ -145,7 +183,7 @@ BOOST_AUTO_TEST_CASE(TabsSwitching) BOOST_CHECK(webkitEngineService->tabsCount() == 1); tizen_browser::basic_webengine::TabId second = webkitEngineService->addTab("www.second.com"); - BOOST_TEST_MESSAGE("Second tab: " << second.toString()); + BOOST_TEST_MESSAGE(TAG "Second tab: " << second.toString()); BOOST_CHECK(webkitEngineService->currentTabId() == first); @@ -161,19 +199,23 @@ BOOST_AUTO_TEST_CASE(TabsSwitching) BOOST_CHECK(find(listTabs.begin(), listTabs.end(), second) != listTabs.end()); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab(second)); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab(second)); BOOST_CHECK(webkitEngineService->currentTabId() == first); BOOST_CHECK(webkitEngineService->tabsCount() == 1); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab(first)); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab(first)); BOOST_CHECK(!(webkitEngineService->tabsCount())); + + BROWSER_LOGI(TAG "--> END - TabsSwitching"); } BOOST_AUTO_TEST_CASE(Snapshots) { + BROWSER_LOGI(TAG "Snapshots - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -189,11 +231,15 @@ BOOST_AUTO_TEST_CASE(Snapshots) webkitEngineService->getSnapshotData(parentTabId, 100, 100); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - Snapshots"); } BOOST_AUTO_TEST_CASE(PrivateModeOnOff) { + BROWSER_LOGI(TAG "PrivateModeOnOff - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -215,11 +261,15 @@ BOOST_AUTO_TEST_CASE(PrivateModeOnOff) BOOST_CHECK(!(webkitEngineService->isPrivateMode())); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - PrivateModeOnOff"); } BOOST_AUTO_TEST_CASE(LoadErrorDefaultValue) { + BROWSER_LOGI(TAG "LoadErrorDefaultValue - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -233,11 +283,15 @@ BOOST_AUTO_TEST_CASE(LoadErrorDefaultValue) BOOST_CHECK(!(webkitEngineService->isLoadError())); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - LoadErrorDefaultValue"); } BOOST_AUTO_TEST_CASE(Focus) { + BROWSER_LOGI(TAG "Focus - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -249,25 +303,29 @@ BOOST_AUTO_TEST_CASE(Focus) tizen_browser::basic_webengine::TabId parentTabId = webkitEngineService->addTab("www.test.com"); - BOOST_TEST_MESSAGE("Has focus at start:" << webkitEngineService->hasFocus()); + BOOST_TEST_MESSAGE(TAG "Has focus at start:" << webkitEngineService->hasFocus()); webkitEngineService->setFocus(); - BOOST_TEST_MESSAGE("Has focus after setting focus:" << webkitEngineService->hasFocus()); + BOOST_TEST_MESSAGE(TAG "Has focus after setting focus:" << webkitEngineService->hasFocus()); webkitEngineService->clearFocus(); - BOOST_TEST_MESSAGE("Has focus after clearing focus:" << webkitEngineService->hasFocus()); + BOOST_TEST_MESSAGE(TAG "Has focus after clearing focus:" << webkitEngineService->hasFocus()); webkitEngineService->setFocus(); - BOOST_TEST_MESSAGE("Has focus after setting focus:" << webkitEngineService->hasFocus()); + BOOST_TEST_MESSAGE(TAG "Has focus after setting focus:" << webkitEngineService->hasFocus()); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - Focus"); } BOOST_AUTO_TEST_CASE(ZoomAndAutofit) { + BROWSER_LOGI(TAG "ZoomAndAutofit - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -279,21 +337,25 @@ BOOST_AUTO_TEST_CASE(ZoomAndAutofit) tizen_browser::basic_webengine::TabId parentTabId = webkitEngineService->addTab("www.test.com"); - BOOST_TEST_MESSAGE("Zoom factor at start:" << webkitEngineService->getZoomFactor()); + BOOST_TEST_MESSAGE(TAG "Zoom factor at start:" << webkitEngineService->getZoomFactor()); webkitEngineService->setZoomFactor(200); - BOOST_TEST_MESSAGE("Zoom factor after setting 200:" << webkitEngineService->getZoomFactor()); + BOOST_TEST_MESSAGE(TAG "Zoom factor after setting 200:" << webkitEngineService->getZoomFactor()); webkitEngineService->setZoomFactor(100); - BOOST_TEST_MESSAGE("Zoom factor after setting 100:" << webkitEngineService->getZoomFactor()); + BOOST_TEST_MESSAGE(TAG "Zoom factor after setting 100:" << webkitEngineService->getZoomFactor()); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - ZoomAndAutofit"); } BOOST_AUTO_TEST_CASE(Favicon) { + BROWSER_LOGI(TAG "Favicon - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -307,12 +369,16 @@ BOOST_AUTO_TEST_CASE(Favicon) webkitEngineService->getFavicon(); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - Favicon"); } BOOST_AUTO_TEST_CASE(SearchOnWebsite) { + BROWSER_LOGI(TAG "SearchOnWebsite - START --> "); + std::shared_ptr> webkitEngineService = std::dynamic_pointer_cast ,tizen_browser::core::AbstractService> @@ -330,7 +396,16 @@ BOOST_AUTO_TEST_CASE(SearchOnWebsite) webkitEngineService->searchOnWebsite("", 0); - BOOST_TEST_MESSAGE("Print closeTab():" << webkitEngineService->closeTab()); + BOOST_TEST_MESSAGE(TAG "Print closeTab():" << webkitEngineService->closeTab()); + + BROWSER_LOGI(TAG "--> END - SearchOnWebsite"); } +//BOOST_AUTO_TEST_CASE(EwkShutdown) +//{ +// BROWSER_LOGI(TAG "EwkShutdown - START --> "); +// BOOST_CHECK(ewk_shutdown() == 0); +// BROWSER_LOGI(TAG "--> END - EwkShutdown"); +//} + BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_coreService.cpp b/unit_tests/ut_coreService.cpp index cfd0649..135e553 100644 --- a/unit_tests/ut_coreService.cpp +++ b/unit_tests/ut_coreService.cpp @@ -19,7 +19,9 @@ #include #include "ServiceManager.h" -#include "Services/ServiceInterface.h" +#include "BrowserLogger.h" +#include "BookmarkService.h" + BOOST_AUTO_TEST_SUITE(core_ServiceManager) @@ -27,19 +29,25 @@ namespace tbc=tizen_browser::core; BOOST_AUTO_TEST_CASE(singleton) { + BROWSER_LOGI("[UT] CoreService - singleton - START --> "); + // check if service manager is singleton tbc::ServiceManager *serviceManager_instance_01 = &tbc::ServiceManager::getInstance(); tbc::ServiceManager *serviceManager_instance_02 = &tbc::ServiceManager::getInstance(); BOOST_CHECK_EQUAL(serviceManager_instance_01, serviceManager_instance_02); + + BROWSER_LOGI("[UT] --> END - CoreService - singleton"); } BOOST_AUTO_TEST_CASE(getService) { - std::string serviceName("org.tizen.browser.TestServiceOne"); + BROWSER_LOGI("[UT] CoreService - getService - START --> "); + + std::string serviceName("org.tizen.browser.favoriteservice"); tbc::ServiceManager *servManager = &tbc::ServiceManager::getInstance(); - std::shared_ptr service1 = std::dynamic_pointer_cast - + std::shared_ptr service1 = std::dynamic_pointer_cast + (servManager->getService(serviceName)); BOOST_REQUIRE(service1); std::string nameFromService = service1->getName(); @@ -47,6 +55,8 @@ BOOST_AUTO_TEST_CASE(getService) nameFromService.end(), serviceName.begin(), serviceName.end()); + + BROWSER_LOGI("[UT] --> END - CoreService - getService"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/ut_logger.cpp b/unit_tests/ut_logger.cpp index 1c321e2..d6250d9 100644 --- a/unit_tests/ut_logger.cpp +++ b/unit_tests/ut_logger.cpp @@ -29,6 +29,8 @@ #include "Logger.h" #include "AbstractLogger.h" +#include "BrowserLogger.h" + #define COLOR "\033[41m\033[37m" @@ -63,6 +65,8 @@ struct StubAbstractLogger: tizen_browser::logger::AbstractLogger { // simple tests for inherited interface BOOST_AUTO_TEST_CASE(logger_abstract_logger) { + BROWSER_LOGI("[UT] LOGGER - logger_abstract_logger - START --> "); + std::stringstream ss; ss << boost::unit_test::framework::current_test_case().p_name; @@ -73,6 +77,7 @@ BOOST_AUTO_TEST_CASE(logger_abstract_logger) { sl.log("a", "b", "c"); BOOST_CHECK_EQUAL(sl.getLog().compare("abc\n"), 0); + BROWSER_LOGI("[UT] --> END - LOGGER - logger_abstract_logger"); } class StubLogger: public tizen_browser::logger::Logger { @@ -89,6 +94,8 @@ private: }; BOOST_AUTO_TEST_CASE(logger_init) { + BROWSER_LOGI("[UT] LOGGER - logger_init - START --> "); + std::stringstream ss; ss << boost::unit_test::framework::current_test_case().p_name; @@ -124,6 +131,8 @@ BOOST_AUTO_TEST_CASE(logger_init) { checker.erase(checker.begin(), std::find(checker.begin(), checker.end(), ']') + 1); boost::algorithm::trim(checker); BOOST_CHECK_EQUAL(checker, msg); + + BROWSER_LOGI("[UT] --> END - LOGGER - logger_init"); } ///\todo p.chmielewski -- 2.7.4