[Release] wrt-commons_0.2.97 for sdk branch submit/sdk/20130206.124506
authorTaejeong Lee <taejeong.lee@samsung.com>
Wed, 6 Feb 2013 12:44:38 +0000 (21:44 +0900)
committerTaejeong Lee <taejeong.lee@samsung.com>
Wed, 6 Feb 2013 12:44:38 +0000 (21:44 +0900)
Change-Id: I5e2fa6406bed43f1a60d9781d77469a12e05ddd5

24 files changed:
3rdparty/minizip/ioapi.c
3rdparty/minizip/minizip.c
3rdparty/minizip/mztools.c
3rdparty/minizip/unzip.c
3rdparty/minizip/unzip11.zip [deleted file]
3rdparty/minizip/zip.c
debian/changelog
modules/core/src/waitable_handle_watch_support.cpp
modules/test/config.cmake
modules/test/include/dpl/test/test_runner.h
modules/test/include/dpl/test/test_runner_child.h [new file with mode: 0644]
modules/test/src/test_runner.cpp
modules/test/src/test_runner_child.cpp [new file with mode: 0644]
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h
modules/widget_dao/orm/wrt_db
packaging/wrt-commons.spec
tests/dao/TestCases_WidgetDAO.cpp
tests/dpl/CMakeLists.txt
tests/dpl/test/CMakeLists.txt [new file with mode: 0644]
tests/dpl/test/main.cpp [new file with mode: 0644]
tests/dpl/test/runner_child.cpp [new file with mode: 0644]

index 49958f61ffd660c96031aa49dbcffd08b127ea45..41ab3146f18fa7fee72bcf7d67987f81bde52589 100644 (file)
@@ -22,6 +22,8 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
         return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
     else
     {
+        if (pfilefunc->zopen32_file == NULL)
+            return NULL;
         return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
     }
 }
@@ -33,7 +35,7 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
     else
     {
         uLong offsetTruncated = (uLong)offset;
-        if (offsetTruncated != offset)
+        if (offsetTruncated != offset || pfilefunc->zseek32_file == NULL)
             return -1;
         else
             return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
@@ -46,6 +48,8 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
         return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
     else
     {
+        if (pfilefunc->ztell32_file == NULL)
+            return (ZPOS64_T)-1;
         uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
         if ((tell_uLong) == ((uLong)-1))
             return (ZPOS64_T)-1;
index 7a4fa5a643ebf9ca484cc0654eb10071d16ea885..a0a327ba443f3ddf6dcfdc25f72ce38a6dd64207 100644 (file)
@@ -382,7 +382,7 @@ int main(argc,argv)
                    ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
                   (strlen(argv[i]) == 2)))
             {
-                FILE * fin;
+                FILE * fin = NULL;
                 int size_read;
                 const char* filenameinzip = argv[i];
                 const char *savefilenameinzip;
index f9092e65ae6c5f19813c57d808a9c684a6b0d4fc..edf6b7fa29046f0cdca874cfc6c366ded094ac3a 100644 (file)
@@ -41,7 +41,7 @@ uLong* bytesRecovered;
   if (fpZip != NULL &&  fpOut != NULL) {
     int entries = 0;
     uLong totalBytes = 0;
-    char header[30];
+    char header[30] = {0,};
     char filename[256];
     char extra[1024];
     int offset = 0;
index 7617f41f1ccf9c54ad8e002a956c1b42a5e63b24..27ce758e72360108562e9c8849f6fc9e8ee9f499 100644 (file)
@@ -585,8 +585,8 @@ local unzFile unzOpenInternal (const void *path,
                                zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
                                int is64bitOpenFunction)
 {
-    unz64_s us;
-    unz64_s *s;
+    unz64_s us = {0, };
+    unz64_s *s = NULL;
     ZPOS64_T central_pos;
     uLong   uL;
 
@@ -782,6 +782,7 @@ extern unzFile ZEXPORT unzOpen2_64 (const void *path,
     {
         zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
         zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
+        zlib_filefunc64_32_def_fill.zopen32_file = NULL;
         zlib_filefunc64_32_def_fill.ztell32_file = NULL;
         zlib_filefunc64_32_def_fill.zseek32_file = NULL;
         return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
diff --git a/3rdparty/minizip/unzip11.zip b/3rdparty/minizip/unzip11.zip
deleted file mode 100644 (file)
index fe55dc3..0000000
Binary files a/3rdparty/minizip/unzip11.zip and /dev/null differ
index 3c34fc8bd4925ae4efd0527018bd95c3279a9b23..96b2ba37db0dca8036155437b4c6908ff1441797 100644 (file)
@@ -935,6 +935,7 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
     {
         zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
         zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
+        zlib_filefunc64_32_def_fill.zopen32_file = NULL;
         zlib_filefunc64_32_def_fill.ztell32_file = NULL;
         zlib_filefunc64_32_def_fill.zseek32_file = NULL;
         return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
index e105fef5d59167d1d58859343e01134f74031ce3..c9d2556b36e68029a73fa238efcc553038484c16 100644 (file)
@@ -1,3 +1,20 @@
+wrt-commons (0.2.97) unstable; urgency=low
+
+  * Support for "process per testcase" framework.
+  * Prepare database to support CSP policy for whole widget.
+  * minizip prevent issues fixes
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Wed, 06 Feb 2013 21:32:00 +0900
+
+wrt-commons (0.2.96) unstable; urgency=low
+
+  * Add specific fields to config parser struct for livebox
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.96
+
+ -- Yunchan Cho <yunchan.cho@samsung.com>  Wed, 30 Jan 2013 17:09:01 +0900
+
 wrt-commons (0.2.95) unstable; urgency=low
 
   * Change pkgname to appid and add package id PART 1.
index e3d544cdb479296b28523486a57a741c6f475ed9..66fc8b56aaf55282c5caa8206cad9101ff0591bc 100644 (file)
@@ -38,27 +38,25 @@ WaitableHandleWatchSupport::~WaitableHandleWatchSupport()
     // Developer assertions
     if (!m_watchersMap.empty())
     {
-        LogPedantic("### Leaked watchers map dump ###");
+        LogWarning("### Leaked watchers map dump ###");
 
         for (WaitableHandleWatchersMap::const_iterator iterator = m_watchersMap.begin();
              iterator != m_watchersMap.end();
              ++iterator)
         {
-            LogPedantic("###   Waitable handle: " << iterator->first);
+            LogWarning("###   Waitable handle: " << iterator->first);
 
-            LogPedantic("###     Read listeners: " << iterator->second.readListenersCount);
-            LogPedantic("###     Write listeners: " << iterator->second.writeListenersCount);
+            LogWarning("###     Read listeners: " << iterator->second.readListenersCount);
+            LogWarning("###     Write listeners: " << iterator->second.writeListenersCount);
 
             for (WaitableHandleListenerList::const_iterator listenersIterator = iterator->second.listeners.begin();
                  listenersIterator != iterator->second.listeners.end();
                  ++listenersIterator)
             {
-                LogPedantic("###       Mode: " << listenersIterator->mode << ". Listener: 0x" << std::hex << listenersIterator->listener);
+                LogWarning("###       Mode: " << listenersIterator->mode << ". Listener: 0x" << std::hex << listenersIterator->listener);
             }
         }
     }
-
-    Assert(m_watchersMap.empty() == true);
 }
 
 WaitableHandle WaitableHandleWatchSupport::WaitableInvokerHandle() const
index 69d5341a29a0ff781b675f50918fa9d0ac4de191..d3485cfc8eac7ced36c1d2fada237ab05a44ad6a 100644 (file)
@@ -22,6 +22,7 @@
 SET(DPL_TEST_ENGINE_SOURCES
     ${PROJECT_SOURCE_DIR}/modules/test/src/test_results_collector.cpp
     ${PROJECT_SOURCE_DIR}/modules/test/src/test_runner.cpp
+    ${PROJECT_SOURCE_DIR}/modules/test/src/test_runner_child.cpp
     PARENT_SCOPE
 )
 
@@ -29,6 +30,7 @@ SET(DPL_TEST_ENGINE_SOURCES
 SET(DPL_TEST_ENGINE_HEADERS
     ${PROJECT_SOURCE_DIR}/modules/test/include/dpl/test/test_results_collector.h
     ${PROJECT_SOURCE_DIR}/modules/test/include/dpl/test/test_runner.h
+    ${PROJECT_SOURCE_DIR}/modules/test/include/dpl/test/test_runner_child.h
     PARENT_SCOPE
 )
 
index a4db750f6531b844856df58fe776d315d92633d2..1c4d28a53787e907b07d744bed57576fbb83f247 100644 (file)
@@ -48,6 +48,10 @@ class TestRunner
     bool m_runIgnored;
 
 public:
+    TestRunner()
+      : m_terminate(false)
+    {}
+
     typedef void (*TestCase)();
 
 private:
@@ -85,6 +89,10 @@ private:
 
     DPL::Atomic m_totalAssertions;
 
+    // Terminate without any logs.
+    // Some test requires to call fork function.
+    // Child process must not produce any logs and should die quietly.
+    bool m_terminate;
     void Banner();
     void InvalidArgs(const std::string& message = "Invalid arguments!");
     void Usage();
@@ -120,6 +128,8 @@ public:
         //! \param[in] aMessage error message
         TestFailed(const char* aTest, const char* aFile, int aLine, const std::string &aMessage);
 
+        TestFailed(const std::string &message);
+
         std::string GetMessage() const
         {
             return m_message;
@@ -156,6 +166,8 @@ public:
     typedef std::vector<std::string> ArgsList;
     int ExecTestRunner(const ArgsList& args);
     bool getRunIgnored() const;
+    // The runner will terminate as soon as possible (after current test).
+    void terminate();
 };
 
 typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
diff --git a/modules/test/include/dpl/test/test_runner_child.h b/modules/test/include/dpl/test/test_runner_child.h
new file mode 100644 (file)
index 0000000..1eb9ea6
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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        test_runner_child.h
+ * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version     1.0
+ * @brief       This file is the header file of test runner
+ */
+#ifndef DPL_TEST_RUNNER_CHILD_H
+#define DPL_TEST_RUNNER_CHILD_H
+
+#include <dpl/test/test_runner.h>
+
+namespace DPL {
+namespace Test {
+
+void RunChildProc(TestRunner::TestCase procChild);
+
+} // namespace Test
+} // namespace DPL
+
+#define RUNNER_CHILD_TEST(Proc)                                                      \
+    void Proc();                                                                     \
+    void Proc##Child();                                                              \
+    static int Static##Proc##Init()                                                  \
+    {                                                                                \
+        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);       \
+        return 0;                                                                    \
+    }                                                                                \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
+    void Proc(){                                                                     \
+        DPL::Test::RunChildProc(&Proc##Child);                                       \
+    }                                                                                \
+    void Proc##Child()
+
+#endif // DPL_TEST_RUNNER_CHILD_H
index 506dd103d99a8d06bb2b34d3e1a66f59ed2a6b9e..d2296e8745d67a4c7d41b790713ef268071f46f5 100644 (file)
@@ -80,6 +80,11 @@ TestRunner::TestFailed::TestFailed(const char* aTest,
     m_message = assertMsg.str();
 }
 
+TestRunner::TestFailed::TestFailed(const std::string &message)
+{
+    m_message = message;
+}
+
 void TestRunner::RegisterTest(const char *testName, TestCase proc)
 {
     m_testGroups[m_currentGroup].push_back(TestCaseStruct(testName, proc));
@@ -194,6 +199,10 @@ void TestRunner::RunTests()
                 if (m_startTestId.empty()) {
                     RunTestCase(test);
                 }
+                if (m_terminate == true) {
+                    // Terminate quietly without any logs
+                    return;
+                }
             }
         }
     }
@@ -505,5 +514,10 @@ bool TestRunner::getRunIgnored() const
     return m_runIgnored;
 }
 
+void TestRunner::terminate()
+{
+    m_terminate = true;
+}
+
 }
 } // namespace DPL
diff --git a/modules/test/src/test_runner_child.cpp b/modules/test/src/test_runner_child.cpp
new file mode 100644 (file)
index 0000000..1f1bd98
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ * 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        test_runner_child.cpp
+ * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version     1.0
+ * @brief       This file is the implementation file of test runner
+ */
+#include <stddef.h>
+#include <dpl/test/test_runner.h>
+#include <dpl/test/test_runner_child.h>
+#include <dpl/test/test_results_collector.h>
+#include <dpl/binary_queue.h>
+#include <dpl/exception.h>
+#include <dpl/scoped_free.h>
+#include <dpl/foreach.h>
+#include <dpl/colors.h>
+#include <pcrecpp.h>
+#include <algorithm>
+#include <cstdio>
+#include <memory.h>
+#include <libgen.h>
+#include <cstring>
+#include <cstdlib>
+#include <ctime>
+#include <unistd.h>
+#include <poll.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <dpl/utils/wrt_global_settings.h>
+
+namespace {
+const int PIPE_CLOSED = -1;
+}
+
+namespace DPL
+{
+namespace Test
+{
+
+class PipeWrapper : DPL::Noncopyable {
+public:
+    enum Usage {
+        READONLY,
+        WRITEONLY
+    };
+
+    enum Status {
+        SUCCESS,
+        TIMEOUT,
+        ERROR
+    };
+
+    PipeWrapper(){
+        if (-1 == pipe(m_pipefd)) {
+            m_pipefd[0] = PIPE_CLOSED;
+            m_pipefd[1] = PIPE_CLOSED;
+        }
+    }
+
+    bool isReady(){
+        return m_pipefd[0] != PIPE_CLOSED || m_pipefd[1] != PIPE_CLOSED;
+    }
+
+    void setUsage(Usage usage) {
+        if (usage == READONLY) {
+            closeHelp(1);
+        }
+        if (usage == WRITEONLY) {
+            closeHelp(0);
+        }
+    }
+    ~PipeWrapper(){
+        closeHelp(0);
+        closeHelp(1);
+    }
+
+    Status send(int code, std::string &message) {
+        if (m_pipefd[1] == PIPE_CLOSED)
+            return ERROR;
+
+        std::ostringstream output;
+        output << toBinaryString(code);
+        output << toBinaryString(static_cast<int>(message.size()));
+        output << message;
+
+        std::string binary = output.str();
+        int size = binary.size();
+
+        if ((writeHelp(&size, sizeof(int)) == ERROR) || (writeHelp(binary.c_str(), size) == ERROR)) {
+            return ERROR;
+        }
+        return SUCCESS;
+    }
+
+    Status receive(int &code, std::string &data, time_t deadline) {
+        if (m_pipefd[0] == PIPE_CLOSED)
+            return ERROR;
+
+        int size;
+        Status ret;
+
+        if ((ret = readHelp(&size, sizeof(int), deadline)) != SUCCESS)
+            return ret;
+
+        std::vector<char> buffer;
+        buffer.resize(size);
+
+        if ((ret = readHelp(&buffer[0], size, deadline)) != SUCCESS)
+            return ret;
+
+        try {
+            DPL::BinaryQueue queue;
+            queue.AppendCopy(&buffer[0], size);
+
+            queue.FlattenConsume(&code, sizeof(int));
+            queue.FlattenConsume(&size, sizeof(int));
+
+            buffer.resize(size);
+
+            queue.FlattenConsume(&buffer[0], size);
+            data.assign(buffer.begin(), buffer.end());
+        } catch (DPL::BinaryQueue::Exception::Base &e) {
+            return ERROR;
+        }
+        return SUCCESS;
+    }
+
+    void closeAll() {
+        closeHelp(0);
+        closeHelp(1);
+    }
+private:
+    std::string toBinaryString(int data) {
+        char buffer[sizeof(int)];
+        memcpy(buffer, &data, sizeof(int));
+        return std::string(buffer, buffer+sizeof(int));
+    }
+
+
+    void closeHelp(int desc) {
+        if (m_pipefd[desc] != PIPE_CLOSED) {
+            TEMP_FAILURE_RETRY(close(m_pipefd[desc]));
+            m_pipefd[desc] = PIPE_CLOSED;
+        }
+    }
+
+    Status writeHelp(const void *buffer, int size) {
+        int ready = 0;
+        const char *p = static_cast<const char *>(buffer);
+        while (ready != size) {
+            int ret = write(m_pipefd[1], &p[ready], size-ready);
+
+            if (ret == -1 && (errno == EAGAIN || errno == EINTR))
+                continue;
+
+            if (ret == -1) {
+                closeHelp(1);
+                return ERROR;
+            }
+
+            ready += ret;
+        }
+        return SUCCESS;
+    }
+
+    Status readHelp(void *buf, int size, time_t deadline) {
+        int ready = 0;
+        char *buffer = static_cast<char*>(buf);
+        while (ready != size) {
+            time_t wait = deadline - time(0);
+            wait = wait < 1 ? 1 : wait;
+            pollfd fds = { m_pipefd[0], POLLIN, 0};
+
+            int pollReturn = poll(&fds, 1,  wait * 1000);
+
+            if (pollReturn == 0) {
+                return TIMEOUT; // Timeout
+            }
+
+            if (pollReturn < -1) {
+                return ERROR;
+            }
+
+            int ret = read(m_pipefd[0], &buffer[ready], size-ready);
+
+            if (ret == -1 && (errno == EAGAIN || errno == EINTR))
+                continue;
+
+            if (ret == -1 || ret == 0) {
+                closeHelp(0);
+                return ERROR;
+            }
+
+            ready += ret;
+        }
+        return SUCCESS;
+    }
+
+    int m_pipefd[2];
+};
+
+void RunChildProc(TestRunner::TestCase procChild){
+    PipeWrapper pipe;
+    if (!pipe.isReady()) {
+        throw TestRunner::TestFailed("Pipe creation failed");
+    }
+
+    pid_t pid = fork();
+
+    if (pid == -1)
+        throw TestRunner::TestFailed("Child creation failed");
+
+    if (pid != 0) {
+        // parent code
+        pipe.setUsage(PipeWrapper::READONLY);
+
+        int code;
+        std::string message;
+
+        int pipeReturn = pipe.receive(code, message, time(0)+10);
+
+        if (pipeReturn != PipeWrapper::SUCCESS) { // Timeout or reading error
+            pipe.closeAll();
+            kill(pid, SIGINT);
+        }
+
+        int status;
+        waitpid(pid, &status, 0);
+
+        if (pipeReturn == PipeWrapper::TIMEOUT) {
+            throw TestRunner::TestFailed("Timeout");
+        }
+
+        if (pipeReturn == PipeWrapper::ERROR) {
+            throw TestRunner::TestFailed("Reading pipe error");
+        }
+
+        if (code == 0) {
+            throw TestRunner::TestFailed(message);
+        }
+    } else {
+        // child code
+
+        // End Runner after current test
+        TestRunnerSingleton::Instance().terminate();
+        int code = 1;
+        std::string msg;
+
+//      close(0);        // stdin
+        close(1);        // stdout
+        close(2);        // stderr
+
+        pipe.setUsage(PipeWrapper::WRITEONLY);
+
+        try {
+            procChild();
+        } catch (DPL::Test::TestRunner::TestFailed &e) {
+            msg = e.GetMessage();
+            code = 0;
+        } catch (...) { // Pokemon Catch... cache them all...
+            msg = "unhandled exeception";
+            code = 0;
+        }
+        pipe.send(code, msg);
+    }
+}
+
+} // namespace Test
+} // namespace DPL
index f22671ea0c35f95f0370a41828dfd6410bd490d7..3beb2babce3f23e31960bd3d855879539a501e4d 100644 (file)
@@ -437,6 +437,7 @@ DbWidgetHandle WidgetDAO::registerWidgetInfo(
     row.Set_author_name(widgetConfigurationInfo.authorName);
     row.Set_author_email(widgetConfigurationInfo.authorEmail);
     row.Set_author_href(widgetConfigurationInfo.authorHref);
+    row.Set_csp_policy(widgetConfigurationInfo.cspPolicy);
     row.Set_base_folder(DPL::FromUTF8String(regInfo.baseFolder));
     row.Set_webkit_plugins_required(widgetConfigurationInfo.flashNeeded);
     row.Set_recognized(wacSecurity.isRecognized());
index 03ed3652cad1232d3bbb3e0051e6403d19fe90cc..df8421d96d37c804890467b02703ba154571e97a 100644 (file)
@@ -670,6 +670,12 @@ bool WidgetDAOReadOnly::isTestWidget() const
     }
 }
 
+DPL::OptionalString WidgetDAOReadOnly::getCspPolicy() const
+{
+    WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
+    return row.Get_csp_policy();
+}
+
 bool WidgetDAOReadOnly::getWebkitPluginsRequired() const
 {
     WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
index 1a227ad454bd4dff5fc45d9988ca0aaee4d2f94f..2241a7aada54f6fd37ecb0ae99ffcb9fd310bcb0 100755 (executable)
@@ -237,7 +237,8 @@ class ConfigParserData
         struct BoxContent
         {
             DPL::String m_boxSrc;
-            BoxSizeList m_boxSize ;
+            DPL::String m_boxMouseEvent;
+            BoxSizeList m_boxSize;
             DPL::String m_pdSrc;
             DPL::String m_pdWidth;
             DPL::String m_pdHeight;
@@ -247,6 +248,7 @@ class ConfigParserData
         DPL::String m_icon;
         DPL::String m_liveboxId;
         DPL::String m_primary;
+        DPL::String m_type;
         DPL::String m_autoLaunch;
         DPL::String m_updatePeriod;
         BoxContentInfo m_boxInfo;
@@ -311,6 +313,9 @@ class ConfigParserData
     DPL::OptionalString tizenPkgId;
     DPL::OptionalString tizenAppId;
 
+    //csp polic for widget
+    DPL::OptionalString cspPolicy;
+
     //Application service model list
     ServiceInfoList appServiceList; //It will be removed.
     AppControlInfoList appControlList;
index fa099011ca614ea0bd8ed06757f036a6b6175909..76292ad16fa2969db82e7c53d3bdfce270b72a1a 100644 (file)
@@ -321,7 +321,7 @@ class WidgetDAOReadOnly
     /**
      * Returns tizenAppId for the specified widget
      *
-     * @return tzAppid; 
+     * @return tzAppid;
      * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
      * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
      */
@@ -333,7 +333,7 @@ class WidgetDAOReadOnly
     /**
      * Returns WidgetPkgName for the specified widget
      *
-     * @return pkgName; 
+     * @return pkgName;
      * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
      * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
      */
@@ -497,6 +497,13 @@ class WidgetDAOReadOnly
      */
     DPL::OptionalString getVersion() const;
 
+    /**
+     * This method is used as a getter for csp policy of widget. It should be
+     * provided in configuration file.
+     * @return global csp policy for widget
+     */
+    DPL::OptionalString getCspPolicy() const;
+
     /**
      * This method returns list filed with Common Name entries from certificate.
      *
index 49ba6ee8d573a4844cc9fafd016c219e5ac6489e..9a41d5bc1cfddaadb26ea901220fb90745e45565 100755 (executable)
@@ -31,6 +31,7 @@ CREATE_TABLE(WidgetInfo)
     COLUMN(base_folder,             VARCHAR(256),  DEFAULT '')
     COLUMN(webkit_plugins_required, TINYINT,       DEFAULT 0)
     COLUMN(security_domain,         INT,           DEFAULT 0)
+    COLUMN(csp_policy,              TEXT,          DEFAULT '')
     COLUMN(recognized,              INT,           DEFAULT 0)
     COLUMN(wac_signed,              INT,           DEFAULT 0)
     COLUMN(distributor_signed,      INT,           DEFAULT 0)
index cd1c7d800f84d0171c53eed8f3cae00e0e1e49e7..e3e19eb307adb369ce11861701a288b8b3b49ba9 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt-commons wrt-commons 0.2.95
+#git:framework/web/wrt-commons wrt-commons 0.2.97
 Name:       wrt-commons
 Summary:    Wrt common library
-Version:    0.2.95
+Version:    0.2.97
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 13ea61c50f2772626bfbb05d1d9bad43df779784..0add48d72fa2d61803b5d905a553f25ddfdefd18 100644 (file)
@@ -977,4 +977,41 @@ RUNNER_TEST(widget_dao_test_wac_security)
     }
 }
 
+/*
+Name: widget_dao_test_register_scp
+Description: Tests inserting and returning scp policy information
+Expected: Value inserted into database should match values received from database
+*/
+RUNNER_TEST(widget_dao_test_register_scp)
+{
+    WacSecurityMock sec;
+    WidgetRegisterInfo regInfo;
+    DPL::OptionalString policy = DPL::FromUTF8String("Some awesome csp policy");
+    regInfo.configInfo.cspPolicy = policy;
+    {
+        // register widget
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+        WidgetDAO dao(tizenAppId);
+
+        RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getCspPolicy(), DPL::ToUTF8String(*policy));
+    }
+}
+
+/*
+Name: widget_dao_test_register_csp_empty
+Description: Tests inserting and returning empty csp policy
+Expected: Value inserted into database should match values received from database
+*/
+RUNNER_TEST(widget_dao_test_register_csp_empty)
+{
+    WacSecurityMock sec;
+    WidgetRegisterInfo regInfo;
+    {
+        // register widget
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+        WidgetDAO dao(tizenAppId);
+
+        RUNNER_ASSERT_MSG(dao.getCspPolicy().IsNull(), "Policy is not null");
+    }
+}
 #undef RUNNER_ASSERT_WHAT_EQUALS
index b2348aa4a8d2831650c15a651b244f247586c0ba..1dea7743956f245a3861b9f6b629dd44c77340f5 100644 (file)
@@ -26,3 +26,4 @@ ADD_SUBDIRECTORY(dbus)
 ADD_SUBDIRECTORY(event)
 #ADD_SUBDIRECTORY(localization) TODO localization mockups need to be fixed 
 ADD_SUBDIRECTORY(utils)
+ADD_SUBDIRECTORY(test)
diff --git a/tests/dpl/test/CMakeLists.txt b/tests/dpl/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6e34912
--- /dev/null
@@ -0,0 +1,31 @@
+# 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      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
+# @version     1.0
+# @brief
+#
+
+SET(TARGET_NAME "dpl-tests-test")
+
+# Set DPL tests sources
+SET(DPL_TESTS_UTIL_SOURCES
+    ${TESTS_DPL_DIR}/test/main.cpp
+    ${TESTS_DPL_DIR}/test/runner_child.cpp
+)
+
+#WRT_TEST_ADD_INTERNAL_DEPENDENCIES(${TARGET_NAME} ${TARGET_DPL_UTILS_EFL})
+WRT_TEST_BUILD(${TARGET_NAME} ${DPL_TESTS_UTIL_SOURCES})
+WRT_TEST_INSTALL(${TARGET_NAME})
diff --git a/tests/dpl/test/main.cpp b/tests/dpl/test/main.cpp
new file mode 100644 (file)
index 0000000..42ffe3a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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        main.cpp
+ * @author      Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
+ * @version     1.0
+ * @brief       This file is the implementation file of main
+ */
+#include <dpl/test/test_runner.h>
+
+int main(int argc, char *argv[])
+{
+    return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
+}
+
diff --git a/tests/dpl/test/runner_child.cpp b/tests/dpl/test/runner_child.cpp
new file mode 100644 (file)
index 0000000..f5ae79b
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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    widget_version.cpp
+ * @author  Bartlomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ * @brief   Implementation file for test cases for engine internal tests
+ */
+#include <dpl/test/test_runner_child.h>
+#include <unistd.h>
+#include <vector>
+#include <sys/types.h>
+#include <signal.h>
+
+RUNNER_TEST_GROUP_INIT(DPL_TESTS_TEST_CHILD)
+
+RUNNER_TEST(t00_pass)
+{
+    RUNNER_ASSERT_MSG(1, "This test should pass");
+}
+
+RUNNER_CHILD_TEST(t01_pass)
+{
+    RUNNER_ASSERT_MSG(1, "This test should pass");
+}
+
+RUNNER_CHILD_TEST(t02_fail)
+{
+    RUNNER_ASSERT_MSG(0, "This test should fail");
+}
+
+RUNNER_CHILD_TEST(t03_fail_timeout)
+{
+    sleep(20);
+    RUNNER_ASSERT_MSG(1, "This test should fail");
+}
+
+RUNNER_CHILD_TEST(t04_fail)
+{
+   RUNNER_ASSERT_MSG(1, "This test should fail");
+   RUNNER_ASSERT_MSG(1, "This test should fail");
+   RUNNER_ASSERT_MSG(1, "This test should fail");
+   RUNNER_ASSERT_MSG(1, "This test should fail");
+   RUNNER_ASSERT_MSG(0, "This test should fail");
+}
+
+RUNNER_CHILD_TEST(t05_fail_child_died)
+{
+    kill(getpid(), SIGKILL);
+    RUNNER_ASSERT_MSG(1, "This test should fail");
+}
+
+RUNNER_CHILD_TEST(t06_pass_8_second_test)
+{
+    sleep(8);
+    RUNNER_ASSERT_MSG(1, "This test should pass");
+}
+
+RUNNER_CHILD_TEST(t07_fail_unknown_exception)
+{
+    throw("hello");
+}
+
+RUNNER_CHILD_TEST(t08_fail_unknown_exception)
+{
+    throw(1);
+}
+
+RUNNER_CHILD_TEST(t09_fail_you_should_see_text_normal_assert)
+{
+    RUNNER_ASSERT_MSG(0, "Normal assert");
+}
+
+RUNNER_CHILD_TEST(t10_pass)
+{
+    RUNNER_ASSERT_MSG(1, "Normal assert");
+}
+