Analysing and removing compilation warnings in wrt repository
authorKarol Pawlowski <k.pawlowski@samsung.com>
Tue, 19 Feb 2013 09:28:06 +0000 (10:28 +0100)
committerGerrit Code Review <gerrit2@kim11>
Thu, 21 Feb 2013 13:40:58 +0000 (22:40 +0900)
[Issue#]        LINUXWRT-7
[Problem]       Too many warnings
[Cause]         N/A
[Solution]      N/A
[Verification]  Build wrt repository

Change-Id: I6ae57ca213ac3ebb778fc5d3ed49fdf97043345f

16 files changed:
src/api_new/runnable_widget_object.cpp
src/api_new/webkit_csp_support_mock.h
src/domain/widget_model.h
src/view/webkit/bundles/wrt-wk2-bundle.cpp
src/view/webkit/view_logic.cpp
src/wrt-client/wrt-client.cpp
src/wrt-launchpad-daemon/launchpad_src/launchpad.c
src/wrt-launchpad-daemon/launchpad_src/util_x.c
src/wrt-launchpad-daemon/src/app_sock.c
tests/widgets/common/CMakeLists.txt
tests/widgets/common/include/TestBase.h [deleted file]
tests/widgets/common/include/WidgetRunner.h [deleted file]
tests/widgets/common/include/loop_control.h [deleted file]
tests/widgets/common/src/TestBase.cpp [deleted file]
tests/widgets/common/src/WidgetRunner.cpp [deleted file]
tests/widgets/common/src/loop_control.cpp [deleted file]

index 954ff9b..9758a71 100644 (file)
@@ -58,7 +58,12 @@ RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model) :
         // Set privilege by tizen id
         // this code prevent that widget launch with "root" permission,
         // when developers launch by command in the shell
-        set_privilege(DPL::ToUTF8String(m_widgetModel->TizenId).c_str());
+
+        set_app_privilege(
+                DPL::ToUTF8String(m_widgetModel->TizenId).c_str(),
+                m_widgetModel->Type.Get().getApptypeToString().c_str(),
+                DPL::ToUTF8String(m_widgetModel->InstallPath.Get()).c_str()
+                );
     }
 }
 
index cdd4d9b..9eeb39f 100644 (file)
@@ -53,7 +53,7 @@ typedef struct _CSP_Rules{
  *           invalid
  *
  */
-int apply_csp(Ewk_Context* context, WKStringRef policy, CSP_Rules *local, CSP_Rules *http_meta)
+int apply_csp(Ewk_Context* /*context*/, WKStringRef /*policy*/, CSP_Rules */*local*/, CSP_Rules */*http_meta*/)
 {
     LogDebug("Setting csp policy");
     return 0;
index a4137d4..431c6b6 100644 (file)
@@ -71,6 +71,13 @@ class WidgetModel : public DPL::Event::Model
                          DPL::Event::PropertyStorageDynamicCached> Type;
 
     /**
+     * @brief Config file based csp policy
+     */
+    DPL::Event::Property<DPL::OptionalString,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> CspPolicy;
+
+    /**
      * @brief Current widget actual size
      */
     DPL::Event::Property<WidgetSize> ActualSize;
@@ -165,13 +172,6 @@ class WidgetModel : public DPL::Event::Model
     DPL::Event::Property<OptionalWidgetIcon> Icon;
 
     /**
-     * @brief Config file based csp policy
-     */
-    DPL::Event::Property<DPL::OptionalString,
-                         DPL::Event::PropertyReadOnly,
-                         DPL::Event::PropertyStorageDynamicCached> CspPolicy;
-
-    /**
      * @brief Widget splash image src
      */
     DPL::Event::Property<DPL::OptionalString,
index 239002a..de28673 100644 (file)
@@ -960,6 +960,8 @@ void Bundle::connectLoaderClientCallbacksToPage(WKBundlePageRef page)
         0, /* willDestroyGlobalObjectForDOMWindowExtension */
         0, /* didFinishProgress */
         0, /* shouldForceUniversalAccessFromLocalURL */
+        0, /* didReceiveIntentForFrame */
+        0, /* registerIntentServiceForFrame */
     };
     WKBundlePageSetPageLoaderClient(page, &loaderClient);
 }
index bbcaed3..093fd8e 100644 (file)
@@ -1113,7 +1113,7 @@ void ViewLogic::contextmenuCustomizeCallback(
         }
     } else {
         LogDebug("ContextMenu Enable!!");
-        int menu_num = ewk_context_menu_item_count(menu);
+        unsigned int menu_num = ewk_context_menu_item_count(menu);
         unsigned int idx = 0;
         do {
             Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu,
@@ -1521,7 +1521,7 @@ void saveUserResponse(Wrt::Popup::PopupResponse response,
 //have to be separated
 //TODO attach database only one at the start (not in every callback?)
 void ViewLogic::protocolHandlerRegistrationCallback(void* data,
-                                                    Evas_Object* obj,
+                                                    Evas_Object* /*obj*/,
                                                     void* eventInfo)
 {
     Assert(data);
@@ -1607,7 +1607,7 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
 }
 
 void ViewLogic::protocolHandlerIsRegisteredCallback(void* data,
-                                                    Evas_Object* obj,
+                                                    Evas_Object* /*obj*/,
                                                     void* eventInfo)
 {
     LogDebug("enter");
@@ -1640,7 +1640,7 @@ void ViewLogic::protocolHandlerIsRegisteredCallback(void* data,
 }
 
 void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
-                                                      Evas_Object* obj,
+                                                      Evas_Object* /*obj*/,
                                                       void* eventInfo)
 {
     LogDebug("enter");
@@ -1670,7 +1670,7 @@ void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
 }
 
 void ViewLogic::contentHandlerRegistrationCallback(void* data,
-                                                   Evas_Object* obj,
+                                                   Evas_Object* /*obj*/,
                                                    void* eventInfo)
 {
     Assert(data);
@@ -1734,7 +1734,7 @@ void ViewLogic::contentHandlerRegistrationCallback(void* data,
 }
 
 void ViewLogic::contentHandlerIsRegisteredCallback(void* data,
-                                                   Evas_Object* obj,
+                                                   Evas_Object* /*obj*/,
                                                    void* eventInfo)
 {
     LogDebug("enter");
@@ -1768,7 +1768,7 @@ void ViewLogic::contentHandlerIsRegisteredCallback(void* data,
 }
 
 void ViewLogic::contentHandlerUnregistrationCallback(void* data,
-                                                     Evas_Object* obj,
+                                                     Evas_Object* /*obj*/,
                                                      void* eventInfo)
 {
     LogDebug("enter");
index a861378..bfd4bb7 100644 (file)
@@ -588,10 +588,10 @@ void WrtClient::backButtonCallback(void* data,
     This->m_widget->Backward();
 }
 
-int WrtClient::appcoreLowMemoryCallback(void* data)
+int WrtClient::appcoreLowMemoryCallback(void* /*data*/)
 {
     LogInfo("appcoreLowMemoryCallback");
-    WrtClient* This = static_cast<WrtClient*>(data);
+    //WrtClient* This = static_cast<WrtClient*>(data);
 
     // TODO call RunnableWidgetObject API regarding low memory
     // The API should be implemented
index b564c1d..ddf707c 100644 (file)
@@ -269,7 +269,7 @@ _static_ void __real_launch(const char *app_path, bundle * kb)
     app_argv = __create_argc_argv(kb, &app_argc);
 
 #ifndef NATIVE_LAUNCHPAD
-    if (__change_cmdline(app_path) < 0) {
+    if (__change_cmdline((char *)app_path) < 0) {
         _E("change cmdline fail");
         return;
     }
index a527888..0ab8f4f 100644 (file)
@@ -78,7 +78,7 @@ static int __find_win(Display *d, Window *win, pid_t pid)
 
     r = XQueryTree(d, *win, &root, &parent, &child, &n);
     if (r) {
-        int i;
+        unsigned int i;
         int found = 0;
 
         for (i = 0; i < n; i++) {
@@ -186,8 +186,9 @@ int x_util_get_default_size(double *w, double *h)
     return 0;
 }
 
-static int __cb_x_error(Display *disp, XErrorEvent *ev)
+static int __cb_x_error(Displaydisp, XErrorEvent *ev)
 {
+    (void)disp;
     _E("X error received - Error Code = %d", ev->error_code);
     return 0;
 }
index 331b62d..decce63 100644 (file)
@@ -150,7 +150,8 @@ int __create_server_sock(int pid)
 int __create_client_sock(int pid)
 {
     int fd = -1;
-    struct sockaddr_un saddr = { 0, };
+    struct sockaddr_un saddr;
+    memset(&saddr, 0, sizeof(saddr));
     int retry = 1;
     int ret = -1;
 
@@ -324,7 +325,8 @@ int __app_send_raw(int pid, int cmd, unsigned char *kb_data, int datalen)
 app_pkt_t *__app_recv_raw(int fd, int *clifd, struct ucred *cr)
 {
     int len;
-    struct sockaddr_un aul_addr = { 0, };
+    struct sockaddr_un aul_addr;
+    memset(&aul_addr, 0, sizeof(aul_addr));
     int sun_size;
     app_pkt_t *pkt = NULL;
     int cl = sizeof(struct ucred);
index 426d1ff..c7b8781 100644 (file)
@@ -33,9 +33,6 @@ WRT_TARGET_LINK_LIBRARIES(${COMMON_LIB_PKGS_LIBRARIES})
 
 SET(WRT_DETAIL_SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/InstallerWrapper.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/WidgetRunner.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/loop_control.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/TestBase.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/RunnableObjectStateTester.cpp
 )
 
diff --git a/tests/widgets/common/include/TestBase.h b/tests/widgets/common/include/TestBase.h
deleted file mode 100644 (file)
index 125f7b4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-#ifndef WRT_EXTRA_AUTO_TESTS_COMMON_INCLUDE_TESTBASE_H
-#define WRT_EXTRA_AUTO_TESTS_COMMON_INCLUDE_TESTBASE_H
-
-#include <string>
-
-#include <dpl/noncopyable.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/localization/LanguageTagsProvider.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-
-#include <WidgetRunner.h>
-
-class TestBase : DPL::Noncopyable
-{
-protected:
-    LanguageTags m_tags;
-
-    WrtDB::WidgetDAOReadOnly* dao;
-
-    std::string m_widgetPath;
-    std::string m_widgetName;
-    WrtDB::WidgetPkgName m_widgetTizenId;
-    bool m_wrongWidgetPackage;
-
-    void CheckRunnerResult(InstallerWrapper::WidgetRunner & runner);
-
-public:
-    TestBase(const std::string & path, const std::string & directory);
-    virtual ~TestBase();
-
-    void StartTest();
-    void CheckIsValid();
-    void CheckIsNotValid();
-
-    void MakeScreenshot();
-    /**
-     * @brief CheckWidgetJsHook
-     * @param hookFile hook file
-     */
-    void CheckWidgetJsHook(const char* hookFile = "hook.js");
-    void CheckWidgetJsReady();
-};
-
-
-#endif // WRT_EXTRA_AUTO_TESTS_COMMON_INCLUDE_TESTBASE_H
diff --git a/tests/widgets/common/include/WidgetRunner.h b/tests/widgets/common/include/WidgetRunner.h
deleted file mode 100644 (file)
index e1256dc..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#ifndef WRT_TESTS_W3C_TESTS_WIDGET_RUNNER_H
-#define WRT_TESTS_W3C_TESTS_WIDGET_RUNNER_H
-
-#include <dpl/exception.h>
-#include <string>
-
-namespace InstallerWrapper {
-
-    const std::string tmpFile = "/tmp/widget_runner_tmp_result_file";
-    const std::string TEST_OK = "OK";
-    const std::string TEST_FAIL = "FAIL";
-    const std::string TEST_EXCEPTION = "EXCEPTION";
-    const std::string TEST_MANUAL = "MANUAL";
-
-    class WidgetRunner {
-    public:
-        WidgetRunner(std::string widgetTizenId, const std::string & name);
-        bool addTestHook(const char* packageName, const char* hookFile = "hook.js");
-        /**
-         * @brief run Launches test in wrt-client and collect its output from 4 descriptor
-         * @param hasHook if true messages from js hook are expected in debug
-         * @return true if success
-         */
-        bool run(bool doScreen = false);
-        std::string getResult() const;
-        std::string getResultWidgetName() const;
-        /**
-         * @brief setHasHook Stes if test has a hook
-         * @param hasHook value
-         */
-        void setHasHook(bool hasHook);
-    private:
-
-        DECLARE_EXCEPTION_TYPE(DPL::Exception, GetArgException)
-
-        //timeout for 'popen'ed' process output (in seconds)
-        static const unsigned popenTimeout;
-
-        std::string m_widgetTizenId;
-        std::string m_name; //name of file is fs
-        std::string m_result; //result of test
-        std::string m_resultWidgetName; //name as test presents itselfs
-        bool m_hasHook;
-        std::string getArg(FILE* file, std::string & lastBuffer);
-        /**
-         * @brief getArgs
-         *
-         * Reads parameters from file descriptor
-         *
-         * @param file fiel descriptor
-         * @param id id of widget
-         * @param result result value
-         * @param resultWidgetName widget name
-         * @throw WidgetRunner::GetArgException if parameters cannot be read
-         */
-        void getArgs(FILE* file, std::string & id, std::string & result,
-                std::string & resultWidgetName);
-        /**
-         * @brief getArgs
-         *
-         * Reads only text from widget initialzation
-         *
-         * @param file file descriptor
-         * @param initText first inital text from widget initialization
-         * @throw WidgetRunner::GetArgException if parameters cannot be read
-         */
-        void getInitWidgetText(FILE* file, std::string initText);
-        /**
-         * @brief calculateArgumentAndBuffer
-         *
-         * Receives argument from buffer
-         *
-         * @param arg argument to be set
-         * @param lastBuffer buffer to be modified
-         *
-         * Both parameters will be modified
-         *
-         * @return true if arg was succesfully read
-         */
-        bool calculateArgumentAndBuffer(std::string & arg, std::string & lastBuffer);
-    };
-}
-
-#endif /* WRT_TESTS_W3C_TESTS_WIDGET_RUNNER_H */
-
diff --git a/tests/widgets/common/include/loop_control.h b/tests/widgets/common/include/loop_control.h
deleted file mode 100644 (file)
index 30aa6e8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2011 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        loop_control.cpp
- * @author      Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @version     1.0
- * @brief       This file is the definitions of loop controlling utilities
- */
-
-
-#ifndef LOOP_CONTROL_H_
-#define LOOP_CONTROL_H_
-
-namespace LoopControl
-{
-
-void init_loop(int argc, char *argv[]);
-void wait_for_wrt_init();
-void finish_wait_for_wrt_init();
-void quit_loop();
-
-void wrt_start_loop();
-void wrt_end_loop();
-
-void *abstract_window();
-
-}
-
-#endif /* LOOP_CONTROL_H_ */
diff --git a/tests/widgets/common/src/TestBase.cpp b/tests/widgets/common/src/TestBase.cpp
deleted file mode 100644 (file)
index 4e5d524..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#include <TestBase.h>
-
-#include <dpl/string.h>
-
-#include <InstallerWrapper.h>
-#include <dpl/test/test_runner.h>
-
-using namespace WrtDB;
-
-TestBase::TestBase(const std::string & path, const std::string & directory) :
-    dao(0),
-    m_widgetPath (std::string(WrtDB::GlobalConfig::GetTestsDataPath()) +
-                + "/" + directory + "/" + path),
-    m_widgetName(path.substr(0, path.find_first_of('.'))),
-    m_wrongWidgetPackage(false)
-{
-    LanguageTagsProviderSingleton::Instance().setLanguageTagsFromLocales("en");
-    m_tags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
-}
-
-TestBase::~TestBase()
-{
-    LogDebug("Finishing test case");
-
-    LogDebug("deleting dao");
-    if (dao)
-    {
-        delete dao;
-        LogDebug("Uninstalling widget " << m_widgetTizenId);
-        InstallerWrapper::uninstall(DPL::ToUTF8String(m_widgetTizenId));
-    }
-
-    LogDebug("Finished");
-}
-
-void TestBase::StartTest()
-{
-    std::string id;
-    InstallerWrapper::InstallResult result =
-            InstallerWrapper::install(m_widgetPath, id);
-    if (InstallerWrapper::OtherError == result) {
-        this->dao = NULL;
-        m_wrongWidgetPackage = false;
-    } else if (InstallerWrapper::WrongWidgetPackage == result) {
-        this->dao = NULL;
-        m_wrongWidgetPackage = true;
-    } else {
-        m_widgetTizenId = DPL::FromASCIIString(id);
-        this->dao = new WidgetDAOReadOnly(m_widgetTizenId);
-    }
-}
-
-void TestBase::CheckIsNotValid()
-{
-    DPL::String msg;
-    if (dao)
-    {
-        msg = L"Widget should not be installed but has been anyway";
-    } else if (!m_wrongWidgetPackage) {
-        msg = L"Unknown error happend";
-    }
-
-    RUNNER_ASSERT_MSG(!dao && m_wrongWidgetPackage,
-                      "Install finished with: " << msg);
-}
-
-void TestBase::CheckIsValid()
-{
-    DPL::String msg;
-    if (!dao) {
-        if (m_wrongWidgetPackage) {
-            msg = L"Wrong widget package";
-        } else {
-            msg = L"Unknown error happend";
-        }
-    }
-
-    RUNNER_ASSERT_MSG(dao && !m_wrongWidgetPackage,
-                      "Install finished with: " << msg);
-}
-
-void TestBase::MakeScreenshot()
-{
-    InstallerWrapper::WidgetRunner runner(DPL::ToUTF8String(m_widgetTizenId), m_widgetName);
-    if (!runner.run(true)) {
-        RUNNER_ASSERT_MSG(false, "Screenshot was not made");
-    }
-}
-
-void TestBase::CheckWidgetJsHook(const char* hookFile)
-{
-    DPL::String package_name = this->dao->getPkgName();
-    InstallerWrapper::WidgetRunner runner(DPL::ToUTF8String(m_widgetTizenId), m_widgetName);
-    RUNNER_ASSERT_MSG(
-        runner.addTestHook(DPL::ToUTF8String(package_name).c_str(), hookFile),
-        "Couldn't add hook to " << hookFile);
-    RUNNER_ASSERT_MSG(runner.run(true), "Get test result for "
-            << runner.getResultWidgetName());
-    std::string res = runner.getResult();
-    RUNNER_ASSERT_MSG(InstallerWrapper::TEST_OK == res,
-            "Test " << runner.getResultWidgetName() << " result: " << res);
-}
-
-void TestBase::CheckWidgetJsReady()
-{
-    InstallerWrapper::WidgetRunner runner(DPL::ToUTF8String(m_widgetTizenId), m_widgetName);
-
-    runner.setHasHook(true);
-
-    if (runner.run(false)) {
-        CheckRunnerResult(runner);
-    } else {
-        RUNNER_ASSERT_MSG(false, "Fail to get test result for "
-                << runner.getResultWidgetName());
-    }
-}
-
-void TestBase::CheckRunnerResult(InstallerWrapper::WidgetRunner & runner)
-{
-    std::string res = runner.getResult();
-    LogDebug("Result: " << res);
-    if (InstallerWrapper::TEST_OK == res) {
-        RUNNER_ASSERT_MSG(true, "Test " << runner.getResultWidgetName()
-                << " passed");
-    }
-    else if (InstallerWrapper::TEST_FAIL == res){
-        RUNNER_ASSERT_MSG(false, "Test " << runner.getResultWidgetName()
-                << " failed");
-    }
-    else if (InstallerWrapper::TEST_EXCEPTION == res) {
-        RUNNER_ASSERT_MSG(false, "Test " << runner.getResultWidgetName()
-                << " threw exception");
-    }
-    else {
-        RUNNER_ASSERT_MSG(false, "Unknown result: " << res);
-    }
-}
diff --git a/tests/widgets/common/src/WidgetRunner.cpp b/tests/widgets/common/src/WidgetRunner.cpp
deleted file mode 100644 (file)
index fb83e1b..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#include "WidgetRunner.h"
-
-#include <stdio.h>
-#include <cstdlib>
-#include <fcntl.h>
-#include <dpl/assert.h>
-#include <dpl/log/log.h>
-#include <dpl/wrt-dao-ro/widget_config.h>
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include <dpl/scoped_fclose.h>
-#include <dpl/utils/wrt_global_settings.h>
-#include <dpl/string.h>
-
-#include <InstallerWrapper.h>
-
-namespace InstallerWrapper {
-
-    const unsigned WidgetRunner::popenTimeout = 10;
-
-    WidgetRunner::WidgetRunner(std::string widgeTizenId, const std::string & name) {
-        m_widgetTizenId = widgeTizenId;
-        m_name = name;
-        m_hasHook = false;
-    }
-
-    bool WidgetRunner::addTestHook(const char* packageName, const char* hookFile)
-    {
-        Assert(packageName != NULL && "packageName is null");
-        std::string widgetHookJs(
-                WrtDB::WidgetConfig::GetWidgetBasePath(
-                        DPL::FromUTF8String(std::string(packageName))));
-        widgetHookJs += WrtDB::GlobalConfig::GetWidgetSrcPath();
-        widgetHookJs += "/";
-        widgetHookJs += hookFile;
-        DPL::ScopedFClose fp;
-        fp.Reset(fopen(widgetHookJs.c_str(), "r"));
-        if (!fp) {
-            LogError(widgetHookJs << " not found");
-            m_hasHook = false;
-            return false;
-        } else {
-            std::string command(
-                "sed -i \"s/function hook(id, result, message){};/"
-                "function hook(id, result, message){widget \\&\\& "
-                "widget.__test \\&\\& "
-                "(widget.__test.setEvaluator(function()"
-                "{return result == 'pass';}),"
-                "widget.__test.run(0.000000));}; /\" ");
-            command += widgetHookJs;
-            system(command.c_str());
-            m_hasHook = true;
-            return true;
-        }
-    }
-
-    void WidgetRunner::getInitWidgetText(FILE* file, std::string initText)
-    {
-        std::string lastBuffer;
-        initText = getArg(file, lastBuffer);
-        LogDebug("Init Widget text: " << initText);
-    }
-
-    void WidgetRunner::getArgs(FILE* file, std::string & id,
-            std::string & result, std::string & resultWidgetName) {
-        std::string lastBuffer;
-        id = getArg(file, lastBuffer);
-        LogDebug("ID: " << id);
-        resultWidgetName = getArg(file, lastBuffer);
-        LogDebug("ResultWidgetName: " << resultWidgetName);
-        result = getArg(file, lastBuffer);
-        LogDebug("Result: " << result);
-    }
-
-    std::string WidgetRunner::getArg(FILE* file, std::string & lastBuffer) {
-        const int count = 100;
-        const int fd = fileno(file);
-
-        std::string arg;
-        char buffer[count];
-        bool done = false;
-        int tries = popenTimeout;
-
-        while (!done) {
-            ssize_t rcount = read(fd, buffer, count);
-            if (rcount == -1 && errno == EAGAIN) {
-                sleep(1);
-                if (tries > 0) {
-                    tries--;
-                } else {
-                    Throw(GetArgException);
-                }
-            } else if (rcount > 0) {
-                //copy buffer
-                for (ssize_t i = 0; i < rcount; i++) {
-                    lastBuffer += buffer[i];
-                }
-            } else {
-                //pipe closed
-                Throw(GetArgException);
-            }
-            //receive requested argument from buffer
-            done = calculateArgumentAndBuffer(arg, lastBuffer);
-        }
-
-        return arg;
-    }
-
-    bool WidgetRunner::calculateArgumentAndBuffer(std::string & arg,
-            std::string & lastBuffer) {
-        //get argument
-        int posOfN = lastBuffer.find_first_of('\n');
-        int posOfT = lastBuffer.find_first_of('\t');
-        if (posOfN >= 0) {
-            if (posOfT >= 0) {
-                if (posOfN < posOfT) {
-                    arg = lastBuffer.substr(0, posOfN);
-                    lastBuffer = lastBuffer.substr(posOfN + 1,
-                            lastBuffer.length());
-                    return true;
-                } else {
-                    arg = lastBuffer.substr(0, posOfT);
-                    lastBuffer = lastBuffer.substr(posOfT + 1,
-                            lastBuffer.length());
-                    return true;
-                }
-            } else {
-                arg = lastBuffer.substr(0, posOfN);
-                lastBuffer = lastBuffer.substr(posOfN + 1,
-                        lastBuffer.length());
-                return true;
-            }
-        } else {
-            if (posOfT >= 0) {
-                arg = lastBuffer.substr(0, posOfT);
-                lastBuffer = lastBuffer.substr(posOfT + 1,
-                        lastBuffer.length());
-                return true;
-            }
-        }
-        return false;
-    }
-
-    bool WidgetRunner::run(bool doScreen) {
-        std::string command;
-        if (!m_hasHook) {
-            command += "DEBUG_LOAD_FINISH=1 ";
-        } else {
-            command += "DEBUG_LOAD_FINISH=0 ";
-        }
-        command += "wrt-client -t ";
-        command += m_widgetTizenId;
-        command += " 4>&1 2>>\"";
-        command += tmpFile;
-        command += "\" 1>>\"";
-        command += tmpFile + "\"";
-        LogDebug(command);
-
-        FILE* result = popen(command.c_str(), "r");
-        fcntl(fileno(result), F_SETFL, O_NONBLOCK);
-
-        if (result) {
-            Try
-            {
-                if (m_hasHook) {
-                    std::string id;
-                    // widget id, test result, widget name
-                    getArgs(result, id, m_result, m_resultWidgetName);
-                } else {
-                    std::string m_test_id;
-                    getInitWidgetText(result, m_test_id);
-                    //this constant string is also in wrt repo, make it constant?
-                    if (m_test_id == "didFinishLoadForFrameCallback: ready")
-                    {
-                        m_resultWidgetName = InstallerWrapper::TEST_MANUAL;
-                    }
-                }
-            }
-
-            Catch(GetArgException) {
-                LogDebug("Test result is not complete");
-            }
-
-            if (GlobalSettings::MakeScreenTestModeEnabled())
-            {
-                if (doScreen) {
-                    if (!m_hasHook) {
-                        LogDebug("Sleeping");
-                        sleep(popenTimeout);
-                    }
-                    //make a screenshot
-                    std::string command = std::string("xwd -root -out ") + m_name
-                            + ".xwd ";
-                    LogDebug("Running system command: " << command);
-                    system(command.c_str());
-                }
-            }
-            // close widget (sigint)
-            sigintWrtClients();
-            pclose(result);
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    std::string WidgetRunner::getResult() const {
-        return m_result;
-    }
-
-    std::string WidgetRunner::getResultWidgetName() const {
-        return m_resultWidgetName;
-    }
-
-    void WidgetRunner::setHasHook(bool hasHook) {
-        m_hasHook = hasHook;
-    }
-}
diff --git a/tests/widgets/common/src/loop_control.cpp b/tests/widgets/common/src/loop_control.cpp
deleted file mode 100644 (file)
index eed375c..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2011 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        loop_control.cpp
- * @author      Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @version     1.0
- * @brief       This is implementation of EFL version of loop control
- */
-
-#include <loop_control.h>
-#include <dpl/log/log.h>
-
-#include <dpl/framework_efl.h>
-
-#include <glib.h>
-#include <glib-object.h>
-
-
-namespace LoopControl
-{
-void init_loop(int argc, char *argv[])
-{
-    (void)argc;
-    (void)argv;
-    g_type_init();
-    g_thread_init(NULL);
-
-    LogInfo("Starting");
-    elm_init(argc, argv);
-}
-
-void wait_for_wrt_init()
-{
-    ecore_main_loop_begin();
-}
-
-void finish_wait_for_wrt_init()
-{
-    ecore_main_loop_quit();
-}
-
-void quit_loop()
-{
-    elm_shutdown();
-}
-
-void wrt_start_loop()
-{
-    ecore_main_loop_begin();
-}
-
-void wrt_end_loop()
-{
-    ecore_main_loop_quit();
-}
-
-void *abstract_window()
-{
-    return elm_win_add(NULL, "hello", ELM_WIN_BASIC);
-}
-
-}//end of LoopControl namespace