From 9b7847bae029e3e0b927efd5eedd4af42863e657 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 21 Feb 2013 08:55:17 +0100 Subject: [PATCH] Enable wrt::RunnableWidgetObject tests [Issue#] LINUXWRT-142 [Bug] Wekbit part cannot be initialized several times in one process. Mock for IViewModule is needed. Additionally mock for ConextManager is needed now. [Cause] N/A [Solution] Create mock for IViewModule and newly created IContextManager. Check actual correct path of execution (graphs are correct). [Verification] Run: wrt-tests-general --output=text. All should pass. Additionally, build web-provider rpm for private environment check if package was built and check if web-provider binary can be runned (with ldd -r or ld) Check if wrt-client renders widgets correctly (run any). Change-Id: Ib261bbfdaa08d91f322c700f49ed735512e535aa --- CMakeLists.txt | 3 +- packaging/wrt.spec | 1 + src/api_new/CMakeLists.txt | 1 + src/api_new/abstract_context_manager.h | 88 ++++++++++++++++++++ src/api_new/ewk_context_manager.cpp | 31 +++---- src/api_new/ewk_context_manager.h | 29 +++---- src/api_new/i_runnable_widget_object.h | 40 +-------- src/api_new/runnable_widget_object.cpp | 30 +++++-- src/api_new/runnable_widget_object.h | 7 +- src/api_new/user_delegates.h | 67 +++++++++++++++ src/view/i_view_module.h | 2 +- tests/widgets/CMakeLists.txt | 2 + tests/widgets/TestCases.cpp | 68 +-------------- tests/widgets/common/CMakeLists.txt | 2 + .../common/include/RunnableObjectStateTester.h | 5 +- .../common/include/mock/MockContextManager.h | 37 +++++++++ tests/widgets/common/include/mock/MockViewModule.h | 52 ++++++++++++ tests/widgets/common/src/InstallerWrapper.cpp | 7 +- .../common/src/RunnableObjectStateTester.cpp | 38 ++++----- .../widgets/common/src/mock/MockContextManager.cpp | 42 ++++++++++ tests/widgets/common/src/mock/MockViewModule.cpp | 92 +++++++++++++++++++++ tests/widgets/files/CMakeLists.txt | 22 +++++ tests/widgets/files/any.wgt | Bin 0 -> 1223 bytes 23 files changed, 490 insertions(+), 176 deletions(-) create mode 100644 src/api_new/abstract_context_manager.h create mode 100644 src/api_new/user_delegates.h create mode 100644 tests/widgets/common/include/mock/MockContextManager.h create mode 100644 tests/widgets/common/include/mock/MockViewModule.h create mode 100644 tests/widgets/common/src/mock/MockContextManager.cpp create mode 100644 tests/widgets/common/src/mock/MockViewModule.cpp create mode 100644 tests/widgets/files/CMakeLists.txt create mode 100644 tests/widgets/files/any.wgt diff --git a/CMakeLists.txt b/CMakeLists.txt index effa699..2350e23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,7 +238,8 @@ ADD_SUBDIRECTORY(po) SET(WRT_API_NEW_INCLUDES "${PROJECT_SOURCE_DIR}/src/api_new/" - "${PROJECT_SOURCE_DIR}/src/domain/") + "${PROJECT_SOURCE_DIR}/src/domain/" + "${PROJECT_SOURCE_DIR}/src/view/") SET(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfig) diff --git a/packaging/wrt.spec b/packaging/wrt.spec index 47e9da0..0fc85ad 100644 --- a/packaging/wrt.spec +++ b/packaging/wrt.spec @@ -158,6 +158,7 @@ systemctl daemon-reload %attr(644,root,root) /usr/etc/wrt/* %if %{with_tests} %attr(755,root,root) %{_bindir}/wrt-tests-general + /opt/share/widget/tests/general/* %endif ## wrt-launchpad-daemon ####################################################### diff --git a/src/api_new/CMakeLists.txt b/src/api_new/CMakeLists.txt index 56c4012..f5af14a 100644 --- a/src/api_new/CMakeLists.txt +++ b/src/api_new/CMakeLists.txt @@ -64,5 +64,6 @@ INSTALL(TARGETS ${TARGET_CORE_MODULE_LIB} INSTALL(FILES ${PROJECT_SOURCE_DIR}/src/api_new/core_module.h ${PROJECT_SOURCE_DIR}/src/api_new/i_runnable_widget_object.h + ${PROJECT_SOURCE_DIR}/src/api_new/user_delegates.h DESTINATION include/${PROJECT_NAME} ) diff --git a/src/api_new/abstract_context_manager.h b/src/api_new/abstract_context_manager.h new file mode 100644 index 0000000..555eb86 --- /dev/null +++ b/src/api_new/abstract_context_manager.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2013 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. + */ +/** + * @file abstract_context_manager.h + * @author Iwanek Tomasz (t.iwanek@samsung.com) + * @version 0.1 + * @brief Abstract file for handling operation regarding Ewk_Context. + */ + +#ifndef ABSTRACT_CONTEXT_MANAGER_H +#define ABSTRACT_CONTEXT_MANAGER_H + +#include +#include +#include +#include + +namespace WRT { + +class AbstractContextManager; +typedef std::shared_ptr ContextManagerPtr; + +typedef std::function ContextManagerFactoryMethod; + +/** + * @brief The AbstractContextManager class Factory for ewk context + * + * This is interface class for ewk context factory. + * It's uses tizenId, view module to initialize it approriatly context. + * + * Constructor should create new context only if ewkContext parameter is NULL. + * If ewkContext parameter is not NULL, context should not be destroyed in destructor. + * This means used context is managed by manager only if was created internally. + * + * NOTE: This interface in not visible outside core module and it should not be. + * Reason for this code is not modify RunnableWidgetObject behaviour for mocks. + */ +class AbstractContextManager { +public: + AbstractContextManager( + const std::string& tizenAppId, + Ewk_Context* ewkContext, + ViewModule::IViewModulePtr viewModule) : + m_appId(tizenAppId), m_ewkContext(ewkContext), m_view(viewModule) {} + virtual ~AbstractContextManager() {} + /** + * @brief getEwkContext returns ewk context + * @return ewk context + */ + virtual Ewk_Context* getEwkContext() const = 0; + /** + * @brief handleLowMemory + * + * Handles low memory conditions + */ + virtual void handleLowMemory() = 0; +protected: + std::string m_appId; + Ewk_Context* m_ewkContext; + ViewModule::IViewModulePtr m_view; +}; + +template ContextManagerPtr contextManagerFactoryMethod(const std::string& id, Ewk_Context* c, ViewModule::IViewModulePtr view) +{ + return ContextManagerPtr( new T(id, c, view) ); +} + +template ContextManagerFactoryMethod makeContextManagerFactoryMethod() +{ + return contextManagerFactoryMethod; +} + +} + +#endif // ABSTRACT_CONTEXT_MANAGER_H diff --git a/src/api_new/ewk_context_manager.cpp b/src/api_new/ewk_context_manager.cpp index d2264fb..a3a1ce2 100644 --- a/src/api_new/ewk_context_manager.cpp +++ b/src/api_new/ewk_context_manager.cpp @@ -34,18 +34,17 @@ #include "ewk_context_manager.h" #include "webkit/bundles/plugin_module_support.h" +namespace WRT { + static const std::string bundlePath("/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so"); static const std::string caCertPath("/opt/usr/share/certs/ca-certificate.crt"); EwkContextManager::EwkContextManager( - std::string& tizenAppId, + const std::string& tizenAppId, Ewk_Context* ewkContext, ViewModule::IViewModulePtr viewModule) - : m_initialized(false) - , m_isInternalContext(false) - , m_appId(tizenAppId) - , m_ewkContext(ewkContext) - , m_view(viewModule) + : AbstractContextManager(tizenAppId, ewkContext, viewModule), + m_initialized(false), m_isInternalContext(false) { if (!initialize()) { ThrowMsg(DPL::Exception, "Fail to intialize EwkContextManager"); @@ -61,15 +60,7 @@ EwkContextManager::~EwkContextManager() destroy(); } -EwkContextManagerPtr EwkContextManager::create( - std::string& tizenAppId, - Ewk_Context* ewkContext, - ViewModule::IViewModulePtr viewModule) -{ - return EwkContextManagerPtr(new EwkContextManager(tizenAppId, ewkContext, viewModule)); -} - -Ewk_Context* EwkContextManager::getEwkContext() +Ewk_Context * EwkContextManager::getEwkContext() const { return m_ewkContext; } @@ -232,3 +223,13 @@ void EwkContextManager::handleLowMemory() //ewk_context_notify_low_memory(m_ewkContext); } +ContextManagerPtr createEwkContextManager( + std::string& tizenAppId, + Ewk_Context* ewkContext, + ViewModule::IViewModulePtr viewModule) +{ + return ContextManagerPtr(new EwkContextManager(tizenAppId, ewkContext, viewModule)); +} + +} + diff --git a/src/api_new/ewk_context_manager.h b/src/api_new/ewk_context_manager.h index 78aada8..7ef9dcd 100644 --- a/src/api_new/ewk_context_manager.h +++ b/src/api_new/ewk_context_manager.h @@ -24,20 +24,17 @@ #ifndef EWK_CONTEXT_MANAGER_H #define EWK_CONTEXT_MANAGER_H -#include -#include -#include +#include -class EwkContextManager; -typedef std::shared_ptr EwkContextManagerPtr; +namespace WRT { -class EwkContextManager { +class EwkContextManager : public AbstractContextManager { public: - static EwkContextManagerPtr create( - std::string& tizenAppId, - Ewk_Context* ewkContext, - ViewModule::IViewModulePtr viewModule); - Ewk_Context* getEwkContext(); + EwkContextManager( + const std::string& tizenAppId, + Ewk_Context* ewkContext, + ViewModule::IViewModulePtr viewModule); + Ewk_Context * getEwkContext() const; void handleLowMemory(); ~EwkContextManager(); @@ -57,17 +54,11 @@ class EwkContextManager { static void vibrationClientStartCallback(uint64_t time, void* data); static void vibrationClientStopCallback(void* data); - explicit EwkContextManager( - std::string& tizenAppId, - Ewk_Context* ewkContext, - ViewModule::IViewModulePtr viewModule); - // members bool m_initialized; bool m_isInternalContext; - std::string m_appId; - Ewk_Context* m_ewkContext; - ViewModule::IViewModulePtr m_view; }; +} + #endif // EWK_CONTEXT_MANAGER_H diff --git a/src/api_new/i_runnable_widget_object.h b/src/api_new/i_runnable_widget_object.h index 49af1d8..b7d1726 100644 --- a/src/api_new/i_runnable_widget_object.h +++ b/src/api_new/i_runnable_widget_object.h @@ -24,49 +24,11 @@ #define RUNNABLE_WIDGET_OBJECT_INTERFACE_H_ #include -#include -#include -#include -#include #include #include +#include namespace WRT { -typedef DPL::FastDelegate0 ProgressFinishCB; -typedef DPL::FastDelegate1 LoadStartCB; -typedef DPL::FastDelegate1 LoadFinishCB; -typedef DPL::FastDelegate0 WebCrashCB; -typedef DPL::FastDelegate2 WindowCreateBeforeCB; -typedef DPL::FastDelegate2 WindowCreateAfterCB; -typedef DPL::FastDelegate1 WindowCloseCB; -typedef DPL::FastDelegate0 WebkitExitCB; -typedef DPL::FastDelegate1 ResumeCB; -typedef DPL::FastDelegate1 SuspendCB; -typedef DPL::FastDelegate1 ResetCB; -typedef DPL::FastDelegate1 BufferUnsetCB; -typedef DPL::FastDelegate1 BufferSetCB; -typedef DPL::FastDelegate1 ToggleFullscreenCB; - -typedef struct UserDelegates { - ProgressFinishCB progressFinish; - LoadStartCB loadStart; - LoadFinishCB loadFinish; - WebCrashCB webCrash; - WindowCreateBeforeCB windowCreateBefore; - WindowCreateAfterCB windowCreateAfter; - WindowCloseCB windowClose; - WebkitExitCB webkitExit; - ResumeCB resume; - SuspendCB suspend; - ResetCB reset; - BufferUnsetCB bufferUnset; - BufferSetCB bufferSet; - ToggleFullscreenCB toggleFullscreen; -} UserDelegates; - -typedef std::shared_ptr UserDelegatesPtr; -typedef std::shared_ptr WidgetModelPtr; /** * @brief The IRunnableWidgetObject class Runnable object interface diff --git a/src/api_new/runnable_widget_object.cpp b/src/api_new/runnable_widget_object.cpp index 9758a71..d4a07a0 100644 --- a/src/api_new/runnable_widget_object.cpp +++ b/src/api_new/runnable_widget_object.cpp @@ -48,7 +48,8 @@ const unsigned int UID_ROOT = 0; namespace WRT { RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model) : m_widgetModel(model), - m_view(ViewModule::createView()) + m_view(ViewModule::createView()), + m_contextManagerFactoryMethod(makeContextManagerFactoryMethod()) { //set initial state of runnable object m_guardstate = std::shared_ptr( @@ -121,14 +122,12 @@ bool RunnableWidgetObject::PrepareView(const std::string &startUrl, std::string appId = DPL::ToUTF8String(m_widgetModel->TizenId); Try { if(!m_ewkContextManager) { - m_ewkContextManager = - EwkContextManager::create(appId, ewkContext, m_view); + m_ewkContextManager = m_contextManagerFactoryMethod(appId, ewkContext, m_view); } else { if (ewkContext && ewkContext != m_ewkContextManager->getEwkContext()) { - m_ewkContextManager = - EwkContextManager::create(appId, ewkContext, m_view); + m_ewkContextManager = m_contextManagerFactoryMethod(appId, ewkContext, m_view); } } } Catch (DPL::Exception) { @@ -287,6 +286,18 @@ void RunnableWidgetObject::FireJavascriptEvent(int event, void* data) change.commit(); } +void RunnableWidgetObject::setViewModule(ViewModule::IViewModulePtr ptr) +{ + LogDebug("Setting ViewModule"); + m_view = ptr; +} + +void RunnableWidgetObject::setContextManagerFactoryMethod(ContextManagerFactoryMethod method) +{ + LogDebug("Setting ContextManagerFactoryMethod"); + m_contextManagerFactoryMethod = method; +} + void RunnableWidgetObject::setNewState( std::shared_ptr sptr) { @@ -297,6 +308,13 @@ void RunnableWidgetObject::setNewState( RunnableWidgetObject::~RunnableWidgetObject() { LogDebug(""); - PluginModuleSupport::shutdown(m_ewkContextManager->getEwkContext()); + if(m_ewkContextManager) + { + PluginModuleSupport::shutdown(m_ewkContextManager->getEwkContext()); + } + else + { + LogError("ewk context manager is null"); + } } } /* namespace WRT */ diff --git a/src/api_new/runnable_widget_object.h b/src/api_new/runnable_widget_object.h index c3e8432..3c1c047 100644 --- a/src/api_new/runnable_widget_object.h +++ b/src/api_new/runnable_widget_object.h @@ -62,6 +62,8 @@ public: void Backward(); void FireJavascriptEvent(int event, void* data); + void setViewModule(ViewModule::IViewModulePtr ptr); + void setContextManagerFactoryMethod(ContextManagerFactoryMethod method); private: bool CheckWACTestCertififedWidget(); @@ -70,7 +72,10 @@ public: WidgetModelPtr m_widgetModel; ViewModule::IViewModulePtr m_view; std::shared_ptr m_guardstate; - EwkContextManagerPtr m_ewkContextManager; + ContextManagerPtr m_ewkContextManager; + + //factor method to be used for creation of context manager when needed + ContextManagerFactoryMethod m_contextManagerFactoryMethod; friend class State::StateChange; }; diff --git a/src/api_new/user_delegates.h b/src/api_new/user_delegates.h new file mode 100644 index 0000000..79e73ec --- /dev/null +++ b/src/api_new/user_delegates.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 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. + */ +/** + * @file user_delegates.h + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief user delegates + */ +#ifndef USER_DELEGATES_H +#define USER_DELEGATES_H + +#include +#include +#include +#include + +namespace WRT { +typedef DPL::FastDelegate0 ProgressFinishCB; +typedef DPL::FastDelegate1 LoadStartCB; +typedef DPL::FastDelegate1 LoadFinishCB; +typedef DPL::FastDelegate0 WebCrashCB; +typedef DPL::FastDelegate2 WindowCreateBeforeCB; +typedef DPL::FastDelegate2 WindowCreateAfterCB; +typedef DPL::FastDelegate1 WindowCloseCB; +typedef DPL::FastDelegate0 WebkitExitCB; +typedef DPL::FastDelegate1 ResumeCB; +typedef DPL::FastDelegate1 SuspendCB; +typedef DPL::FastDelegate1 ResetCB; +typedef DPL::FastDelegate1 BufferUnsetCB; +typedef DPL::FastDelegate1 BufferSetCB; +typedef DPL::FastDelegate1 ToggleFullscreenCB; + +struct UserDelegates { + ProgressFinishCB progressFinish; + LoadStartCB loadStart; + LoadFinishCB loadFinish; + WebCrashCB webCrash; + WindowCreateBeforeCB windowCreateBefore; + WindowCreateAfterCB windowCreateAfter; + WindowCloseCB windowClose; + WebkitExitCB webkitExit; + ResumeCB resume; + SuspendCB suspend; + ResetCB reset; + BufferUnsetCB bufferUnset; + BufferSetCB bufferSet; + ToggleFullscreenCB toggleFullscreen; +}; + +typedef std::shared_ptr UserDelegatesPtr; +typedef std::shared_ptr WidgetModelPtr; +} + +#endif // USER_DELEGATES_H diff --git a/src/view/i_view_module.h b/src/view/i_view_module.h index 26adb24..695140a 100644 --- a/src/view/i_view_module.h +++ b/src/view/i_view_module.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include class WidgetModel; //FORWARD DECLARATION namespace ViewModule { diff --git a/tests/widgets/CMakeLists.txt b/tests/widgets/CMakeLists.txt index 7f0f5db..3037631 100644 --- a/tests/widgets/CMakeLists.txt +++ b/tests/widgets/CMakeLists.txt @@ -58,9 +58,11 @@ include_directories( ${dpl_INCLUDE_DIRS} ${dpl-test_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/common + ${PROJECT_SOURCE_DIR}/src/view ${WRT_API_NEW_INCLUDES} ) +ADD_SUBDIRECTORY(files) ADD_SUBDIRECTORY(common) SET(TESTS_SOURCES diff --git a/tests/widgets/TestCases.cpp b/tests/widgets/TestCases.cpp index 8a6a411..1af0bfe 100644 --- a/tests/widgets/TestCases.cpp +++ b/tests/widgets/TestCases.cpp @@ -28,8 +28,6 @@ namespace { -const std::string miscWidgetsStuff = "/opt/share/widget/tests/misc/"; - struct Result { bool m_exc; bool m_exd; @@ -121,7 +119,9 @@ RUNNER_TEST_GROUP_INIT(RunnableWidgetObjectState) } \ Catch(DPL::Exception) \ { \ - LogDebug("RunnableWidgetObjectStateTest has failed"); \ + ok = false; \ + reason = _rethrown_exception.DumpToString(); \ + reason += "(DPL::Exception)"; \ } \ Catch(std::exception) \ { \ @@ -142,7 +142,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_CheckBeforeLaunch) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( CheckBeforeLaunch ); RUNNABLE_TESTER_STOP @@ -156,7 +155,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Initial_PrepareView) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_ALLOWED( PrepareView ); CALL_TESTER( Hide ); @@ -171,7 +169,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_Show) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( Show ); RUNNABLE_TESTER_STOP @@ -185,7 +182,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_Hide) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( Hide ); RUNNABLE_TESTER_STOP @@ -199,7 +195,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_Suspend) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( Suspend ); RUNNABLE_TESTER_STOP @@ -213,7 +208,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_Resume) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( Resume ); RUNNABLE_TESTER_STOP @@ -227,7 +221,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_Reset) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( Reset ); RUNNABLE_TESTER_STOP @@ -241,7 +234,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_GetCurrentWebview) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( GetCurrentWebview ); RUNNABLE_TESTER_STOP @@ -255,7 +247,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_SetUserDelegates) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( SetUserDelegates ); RUNNABLE_TESTER_STOP @@ -269,7 +260,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Initial_Backward) { - RUNNER_FAIL; RUNNABLE_TESTER_START SHOULD_BE_FORBIDDEN( Backward ); RUNNABLE_TESTER_STOP @@ -285,7 +275,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Prepared_CheckBeforeLaunch) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_ALLOWED( CheckBeforeLaunch ); @@ -301,7 +290,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_PrepareView) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( PrepareView ); @@ -317,7 +305,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_Show) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( Show ); @@ -333,7 +320,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Prepared_Hide) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_ALLOWED( Hide ); @@ -348,7 +334,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_Suspend) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( Suspend ); @@ -364,7 +349,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_Resume) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( Resume ); @@ -380,7 +364,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_Reset) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( Reset ); @@ -396,7 +379,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Prepared_GetCurrentWebview) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_ALLOWED( GetCurrentWebview ); @@ -412,7 +394,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_SetUserDelegates) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( SetUserDelegates ); @@ -428,7 +409,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Prepared_Backward) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); SHOULD_BE_FORBIDDEN( Backward ); @@ -445,7 +425,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_SecChecked_CheckBeforeLaunch) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -462,7 +441,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_SecChecked_PrepareView) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -479,7 +457,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_SecChecked_Show) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -497,7 +474,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_SecChecked_Hide) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -513,7 +489,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_SecChecked_Suspend) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -530,7 +505,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_SecChecked_Resume) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -547,7 +521,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_SecChecked_Reset) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -564,7 +537,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_SecChecked_GetCurrentWebview) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -581,7 +553,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_SecChecked_SetUserDelegates) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -598,7 +569,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_SecChecked_Backward) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -616,7 +586,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Showed_CheckBeforeLaunch) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -634,7 +603,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Showed_PrepareView) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -652,7 +620,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Showed_Show) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -670,7 +637,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Showed_Hide) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -687,7 +653,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Showed_Suspend) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -705,7 +670,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Showed_Resume) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -723,7 +687,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Showed_Reset) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -741,7 +704,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Showed_GetCurrentWebview) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -759,7 +721,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Showed_SetUserDelegates) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -777,7 +738,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Showed_Backward) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -796,7 +756,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Suspended_CheckBeforeLaunch) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -815,7 +774,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Suspended_PrepareView) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -834,7 +792,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Suspended_Show) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -853,7 +810,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Suspended_Hide) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -871,7 +827,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Suspended_Suspend) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -890,7 +845,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Suspended_Resume) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -909,7 +863,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Suspended_Reset) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -928,7 +881,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Suspended_GetCurrentWebview) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -947,7 +899,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Suspended_SetUserDelegates) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -966,7 +917,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Suspended_Backward) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -986,7 +936,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_CheckBeforeLaunch) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1005,7 +954,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_PrepareView) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1024,7 +972,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_Show) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1043,7 +990,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_Hide) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1062,7 +1008,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_Suspend) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1081,7 +1026,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_Resume) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1100,7 +1044,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_Reset) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1108,8 +1051,6 @@ RUNNER_TEST(state_Hidden_Reset) CALL_TESTER( Suspend ); CALL_TESTER( Hide ); SHOULD_BE_FORBIDDEN( Reset ); - CALL_TESTER( PrepareView ); - CALL_TESTER( Hide ); RUNNABLE_TESTER_STOP } @@ -1121,7 +1062,6 @@ Expected: Transistion should pass */ RUNNER_TEST(state_Hidden_GetCurrentWebview) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1140,7 +1080,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_SetUserDelegates) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); @@ -1159,7 +1098,6 @@ Expected: Transistion should fail */ RUNNER_TEST(state_Hidden_Backward) { - RUNNER_FAIL; RUNNABLE_TESTER_START CALL_TESTER( PrepareView ); CALL_TESTER( CheckBeforeLaunch ); diff --git a/tests/widgets/common/CMakeLists.txt b/tests/widgets/common/CMakeLists.txt index c7b8781..e47d3d9 100644 --- a/tests/widgets/common/CMakeLists.txt +++ b/tests/widgets/common/CMakeLists.txt @@ -34,6 +34,8 @@ WRT_TARGET_LINK_LIBRARIES(${COMMON_LIB_PKGS_LIBRARIES}) SET(WRT_DETAIL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/InstallerWrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/RunnableObjectStateTester.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/mock/MockViewModule.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/mock/MockContextManager.cpp ) INCLUDE_DIRECTORIES(${COMMON_INCLUDES}) diff --git a/tests/widgets/common/include/RunnableObjectStateTester.h b/tests/widgets/common/include/RunnableObjectStateTester.h index da5eae7..e9f107c 100644 --- a/tests/widgets/common/include/RunnableObjectStateTester.h +++ b/tests/widgets/common/include/RunnableObjectStateTester.h @@ -34,9 +34,8 @@ #include #include #include -#include #include -#include +#include #include #include @@ -80,11 +79,9 @@ public: private: std::string m_handle; - WrtDB::WidgetDAOReadOnlyPtr m_dao; WRT::RunnableWidgetObjectPtr m_widget; Test m_func; const std::string m_widgetPath; - std::vector m_windows; //for created windows for PrepareView }; typedef DPL::Singleton RunnableObjectStateTesterSingleton; diff --git a/tests/widgets/common/include/mock/MockContextManager.h b/tests/widgets/common/include/mock/MockContextManager.h new file mode 100644 index 0000000..b3a6b7f --- /dev/null +++ b/tests/widgets/common/include/mock/MockContextManager.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013 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. + */ +/** + * @file MockContextManager.h + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief Mock for view module + */ +#ifndef MOCKCONTEXTMANAGER_H +#define MOCKCONTEXTMANAGER_H + +#include + +class MockContextManager : public WRT::AbstractContextManager +{ +public: + MockContextManager(const std::string& tizenAppId, + Ewk_Context* ewkContext, + ViewModule::IViewModulePtr viewModule); + virtual ~MockContextManager(); + Ewk_Context* getEwkContext() const; + void handleLowMemory(); +}; + +#endif // MOCKCONTEXTMANAGER_H diff --git a/tests/widgets/common/include/mock/MockViewModule.h b/tests/widgets/common/include/mock/MockViewModule.h new file mode 100644 index 0000000..4149743 --- /dev/null +++ b/tests/widgets/common/include/mock/MockViewModule.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 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. + */ +/** + * @file MockViewModule.h + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief Mock for view module + */ + +#ifndef MOCKVIEWMODULE_H +#define MOCKVIEWMODULE_H + +#include + +class MockViewModule : public ViewModule::IViewModule +{ +public: + MockViewModule(); + bool createWebView(Ewk_Context* context, + Evas_Object* window); + void prepareView(WidgetModel *, const std::string &); + void showWidget(); + void hideWidget(); + void suspendWidget(); + void resumeWidget(); + void resetWidget(); + void backward(); + void reloadStartPage(); + Evas_Object* getCurrentWebview(); + void fireJavascriptEvent(int event, void* data); + void setUserCallbacks(const WRT::UserDelegatesPtr& cbs); + void checkSyncMessageFromBundle( + const char* name, + const char* body, + char** returnData); + void downloadData(const char* url); + void activateVibration(bool on, uint64_t time); +}; + +#endif // MOCKVIEWMODULE_H diff --git a/tests/widgets/common/src/InstallerWrapper.cpp b/tests/widgets/common/src/InstallerWrapper.cpp index 505a01c..f2b8e55 100644 --- a/tests/widgets/common/src/InstallerWrapper.cpp +++ b/tests/widgets/common/src/InstallerWrapper.cpp @@ -87,20 +87,25 @@ InstallResult install( } return OtherError; } - char id[10]; + char* id = NULL; std::string line; + while ((line = getAndCutInstallerLogLine(msg)) != "") { if (line.find("successful") != std::string::npos) { + id = new char[line.length()]; int nr = sscanf(line.c_str(), INSTALLER_MESSAGE_ID_LINE.c_str(), id); + if (1 != nr) { LogWarning("Can not read widget ID from message: " << line); + delete[] id; return OtherError; } tizenId = id; + delete[] id; if (tizenId != "plugin") { return Success; diff --git a/tests/widgets/common/src/RunnableObjectStateTester.cpp b/tests/widgets/common/src/RunnableObjectStateTester.cpp index 5a67e4a..70ac9e5 100644 --- a/tests/widgets/common/src/RunnableObjectStateTester.cpp +++ b/tests/widgets/common/src/RunnableObjectStateTester.cpp @@ -30,10 +30,13 @@ #include #include +#include +#include + IMPLEMENT_SINGLETON(RunnableObjectStateTester) namespace { -const std::string widgetPathMnimal = "/opt/share/widget/tests/misc/widgets/minimal.wgt"; +const std::string widgetPathMnimal = "/opt/share/widget/tests/general/any.wgt"; const int widgetInitializationTimeBounding = 3; } @@ -83,23 +86,10 @@ void RunnableObjectStateTester::performCheckBeforeLaunch() void RunnableObjectStateTester::performPrepareView() { - LogDebug("win"); - Evas_Object * window = elm_win_util_standard_add("wrt-core-test", "wrt-core-test"); - LogDebug("resize"); - evas_object_resize(window, 100, 100); - LogDebug("ok"); - evas_object_show(window); - m_windows.push_back(window); - - DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao); - if (startUrl.IsNull()) { - LogError("startUrl is null"); - ThrowMsg(CoreModuleFailure, "startUrl is null"); - } - LogDebug("start url done"); - - m_widget->PrepareView(DPL::ToUTF8String(*startUrl), - window); + //this address is invalid but we use mock (may be problematic when implementation'll change) + Evas_Object * fakeWindowAddress = reinterpret_cast(0x01); + m_widget->PrepareView(DPL::ToUTF8String(DPL::String()), + fakeWindowAddress); } void RunnableObjectStateTester::performShow() @@ -157,12 +147,17 @@ void RunnableObjectStateTester::loadFinishCallback(Evas_Object* /*evas*/) void RunnableObjectStateTester::runTest(RunnableObjectStateTester::Test func) { m_widget = WRT::CoreModuleSingleton::Instance().getRunnableWidgetObject(m_handle); + + //as we know we uses specific implementation + WRT::RunnableWidgetObject * m_widget_impl = dynamic_cast(m_widget.get()); + Assert(m_widget_impl); + m_widget_impl->setViewModule(ViewModule::IViewModulePtr(new MockViewModule())); + m_widget_impl->setContextManagerFactoryMethod(WRT::makeContextManagerFactoryMethod()); if(!m_widget) { ThrowMsg(CoreModuleFailure, "getRunnableWidgetObject() fails"); } - m_dao.reset(new WrtDB::WidgetDAOReadOnly(DPL::FromASCIIString(m_handle))); m_func = func; SwitchToStep(&RunnableObjectStateTester::performTest); DPL::Event::ControllerEventHandler::PostTimedEvent(NextStepEvent(), 1.0); //TODO: time hazard @@ -182,11 +177,6 @@ void RunnableObjectStateTester::performTest() } Quit(); - FOREACH(ptr, m_windows) - { - evas_object_del(*ptr); - } - m_windows.clear(); m_widget.reset(); LogDebug("leave"); diff --git a/tests/widgets/common/src/mock/MockContextManager.cpp b/tests/widgets/common/src/mock/MockContextManager.cpp new file mode 100644 index 0000000..38ed673 --- /dev/null +++ b/tests/widgets/common/src/mock/MockContextManager.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2013 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. + */ +/** + * @file MockContextManager.cpp + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief Mock for view module + */ +#include "mock/MockContextManager.h" + +MockContextManager::MockContextManager( + const std::string& tizenAppId, + Ewk_Context* ewkContext, + ViewModule::IViewModulePtr viewModule) : + AbstractContextManager(tizenAppId, ewkContext, viewModule) +{ +} + +MockContextManager::~MockContextManager() +{ +} + +Ewk_Context* MockContextManager::getEwkContext() const +{ + return NULL; +} + +void MockContextManager::handleLowMemory() +{ +} diff --git a/tests/widgets/common/src/mock/MockViewModule.cpp b/tests/widgets/common/src/mock/MockViewModule.cpp new file mode 100644 index 0000000..bfc6374 --- /dev/null +++ b/tests/widgets/common/src/mock/MockViewModule.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013 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. + */ +/** + * @file MockViewModule.cpp + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief Mock for view module + */ + +#include "mock/MockViewModule.h" + +MockViewModule::MockViewModule() +{ +} + +bool MockViewModule::createWebView(Ewk_Context* /*context*/, + Evas_Object* /*window*/) +{ + return true; +} + +void MockViewModule::prepareView(WidgetModel *, const std::string &) +{ +} + +void MockViewModule::showWidget() +{ +} + +void MockViewModule::hideWidget() +{ +} + +void MockViewModule::suspendWidget() +{ +} + +void MockViewModule::resumeWidget() +{ +} + +void MockViewModule::resetWidget() +{ +} + +void MockViewModule::backward() +{ +} + +void MockViewModule::reloadStartPage() +{ +} + +Evas_Object* MockViewModule::getCurrentWebview() +{ + return NULL; +} + +void MockViewModule::fireJavascriptEvent(int /*event*/, void* /*data*/) +{ +} + +void MockViewModule::setUserCallbacks(const WRT::UserDelegatesPtr& /*cbs*/) +{ +} + +void MockViewModule::checkSyncMessageFromBundle( + const char* /*name*/, + const char* /*body*/, + char** /*returnData*/) +{ +} + +void MockViewModule::downloadData(const char* /*url*/) +{ +} + +void MockViewModule::activateVibration(bool /*on*/, uint64_t /*time*/) +{ +} diff --git a/tests/widgets/files/CMakeLists.txt b/tests/widgets/files/CMakeLists.txt new file mode 100644 index 0000000..7d8474e --- /dev/null +++ b/tests/widgets/files/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (c) 2013 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. +# +# @file CMakeLists.txt +# @author Tomasz Iwanek (t.iwanek@samsung.com) +# + +SET(WRT_TESTS_GENERAL_WIDGETS_PATH "/opt/share/widget/tests/general/") + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/any.wgt + DESTINATION ${WRT_TESTS_GENERAL_WIDGETS_PATH}) diff --git a/tests/widgets/files/any.wgt b/tests/widgets/files/any.wgt new file mode 100644 index 0000000000000000000000000000000000000000..05b46b699d3d569111d2de332d03bd2c168f8e28 GIT binary patch literal 1223 zcmWIWW@h1H00FToMn^CMO0Y4=Fk~j@=N0RRhHx@4TkA*$u%_z-mR4{xFtWU0W?%pl z0YLpCKph-l{d!f5OQjeY7-WE05UxM9A~ClhCsnT?FCA`_!Mex*G^1Ygd?DXe(t@si<_CAW=IcjK$|%!TU7vkts= zbvRf%Pp?l=aBaS`Y^#)r#kwtj*Uvxs-K2H(>erL}Czj{j3<`^0>Uzw!UHz|MTGo!= zAMfAaJ%5^au14bCBSqaNrQGxVbRMtfjjmW~e(kGz zs`0;zJFb;#CB>OMKFG0c&ryAQKaq%kyZ7id8eR-P{WSbYQ1hhH=PWT^YQCCQPd6Vb z_VZr)MYpeSR?xh;TZR8|SiV>jyei#N`C7%J$ltSBFUxK3n!ihS!P6~9FS~tQj?Mh} zT&h%bR||iB;l>>Wm5VqosPoKQSEu)Sj?gRyL?C~2iE^s*fA;e&Fv#Zt1DOjL$iO&C z%S_j+$jt$V?twI&KoCX?-Pj49KKt+hQDWbyBi^P(t_KzQLe%3mP6=^B@DjL zzI}>*vEfzQ@z?#kWbzv2KOJ0m=W(-zvOxdql*)G>KR^EarDyuW*H`kE&s0*G#r&l~ z?but_Q?>Vx{!U&n$GA>_i+StJGbgM)UcR64B*CWk;QU0B`!0V~ zk6lf?c-7hOw(4Zg%Dsn+lD)!GH{LenmH2ZbxvwclxT80HN~_29i56xZ>Q*hCc_-Je z(lvZ5vnw7EV4Er#9jAq6uMPnQSTYcU0xUBxCAC5?qXZgY4cd|c-%~LHO!ka5*8v5A zmWOuBZ%A`o>-P0ax+8cr{DAJH+s7k#d1~y{bFa$Id2n>&O=tFa=X?LRzVqQ|{qSVv z3q}(q)BD9oLO#WM7YMn2~{O j-ZdtmGm)YOXdWnPFucvm2DF}m1qhviF31CxL<|f731Oia literal 0 HcmV?d00001 -- 2.7.4