From: Taejeong Lee Date: Wed, 6 Feb 2013 12:44:38 +0000 (+0900) Subject: [Release] wrt-commons_0.2.97 for sdk branch X-Git-Tag: submit/sdk/20130206.124506 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93bceba22948cbf025c92d974595a1e103c24d91;p=platform%2Fframework%2Fweb%2Fwrt-commons.git [Release] wrt-commons_0.2.97 for sdk branch Change-Id: I5e2fa6406bed43f1a60d9781d77469a12e05ddd5 --- diff --git a/3rdparty/minizip/ioapi.c b/3rdparty/minizip/ioapi.c index 49958f6..41ab314 100644 --- a/3rdparty/minizip/ioapi.c +++ b/3rdparty/minizip/ioapi.c @@ -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; diff --git a/3rdparty/minizip/minizip.c b/3rdparty/minizip/minizip.c index 7a4fa5a..a0a327b 100644 --- a/3rdparty/minizip/minizip.c +++ b/3rdparty/minizip/minizip.c @@ -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; diff --git a/3rdparty/minizip/mztools.c b/3rdparty/minizip/mztools.c index f9092e6..edf6b7f 100644 --- a/3rdparty/minizip/mztools.c +++ b/3rdparty/minizip/mztools.c @@ -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; diff --git a/3rdparty/minizip/unzip.c b/3rdparty/minizip/unzip.c index 7617f41..27ce758 100644 --- a/3rdparty/minizip/unzip.c +++ b/3rdparty/minizip/unzip.c @@ -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 index fe55dc3..0000000 Binary files a/3rdparty/minizip/unzip11.zip and /dev/null differ diff --git a/3rdparty/minizip/zip.c b/3rdparty/minizip/zip.c index 3c34fc8..96b2ba3 100644 --- a/3rdparty/minizip/zip.c +++ b/3rdparty/minizip/zip.c @@ -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); diff --git a/debian/changelog b/debian/changelog index e105fef..c9d2556 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 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. diff --git a/modules/core/src/waitable_handle_watch_support.cpp b/modules/core/src/waitable_handle_watch_support.cpp index e3d544c..66fc8b5 100644 --- a/modules/core/src/waitable_handle_watch_support.cpp +++ b/modules/core/src/waitable_handle_watch_support.cpp @@ -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 diff --git a/modules/test/config.cmake b/modules/test/config.cmake index 69d5341..d3485cf 100644 --- a/modules/test/config.cmake +++ b/modules/test/config.cmake @@ -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 ) diff --git a/modules/test/include/dpl/test/test_runner.h b/modules/test/include/dpl/test/test_runner.h index a4db750..1c4d28a 100644 --- a/modules/test/include/dpl/test/test_runner.h +++ b/modules/test/include/dpl/test/test_runner.h @@ -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 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 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 index 0000000..1eb9ea6 --- /dev/null +++ b/modules/test/include/dpl/test/test_runner_child.h @@ -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 + +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 diff --git a/modules/test/src/test_runner.cpp b/modules/test/src/test_runner.cpp index 506dd10..d2296e8 100644 --- a/modules/test/src/test_runner.cpp +++ b/modules/test/src/test_runner.cpp @@ -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 index 0000000..1f1bd98 --- /dev/null +++ b/modules/test/src/test_runner_child.cpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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(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 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(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(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 diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index f22671e..3beb2ba 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -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()); diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index 03ed365..df8421d 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -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); diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h index 1a227ad..2241a7a 100755 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -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; diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h index fa09901..76292ad 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -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. * diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index 49ba6ee..9a41d5b 100755 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -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) diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index cd1c7d8..e3e19eb 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -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 diff --git a/tests/dao/TestCases_WidgetDAO.cpp b/tests/dao/TestCases_WidgetDAO.cpp index 13ea61c..0add48d 100644 --- a/tests/dao/TestCases_WidgetDAO.cpp +++ b/tests/dao/TestCases_WidgetDAO.cpp @@ -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 diff --git a/tests/dpl/CMakeLists.txt b/tests/dpl/CMakeLists.txt index b2348aa..1dea774 100644 --- a/tests/dpl/CMakeLists.txt +++ b/tests/dpl/CMakeLists.txt @@ -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 index 0000000..6e34912 --- /dev/null +++ b/tests/dpl/test/CMakeLists.txt @@ -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 index 0000000..42ffe3a --- /dev/null +++ b/tests/dpl/test/main.cpp @@ -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 + +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 index 0000000..f5ae79b --- /dev/null +++ b/tests/dpl/test/runner_child.cpp @@ -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 +#include +#include +#include +#include + +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"); +} +