int Run(int argc, char** argv,
std::unique_ptr<InstanceBase::Factory> factory) {
factory_ = std::move(factory);
+/* LCOV_EXCL_START */
widget_app_lifecycle_callback_s callback = {
create : [](void *user_data) -> widget_class_h {
WidgetAppBase* b = static_cast<WidgetAppBase*>(user_data);
b->OnTerminate();
}
};
+/* LCOV_EXCL_STOP */
return widget_app_main(argc, argv, &callback, this);
}
%description -n capi-appfw-widget-application-devel
widget application (development files)
-%package -n appcore_widget_unittests
+%package -n appcore-widget-unittests
Summary: GTest for appcore-widget
Group: Development/Libraries
-%description -n appcore_widget_unittests
+%description -n appcore-widget-unittests
GTest for appcore-widget
%{_libdir}/pkgconfig/capi-appfw-widget-application.pc
%{_libdir}/libcapi-appfw-widget-application.so
-%files -n appcore_widget_unittests
+%files -n appcore-widget-unittests
%{_bindir}/appcore-widget-unittest
%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
app_id_ = app_id;
}
+/* LCOV_EXCL_START */
const std::string& GetAppId() const {
return app_id_;
}
+/* LCOV_EXCL_STOP */
void SetPackageId(const std::string& package_id) {
package_id_ = package_id;
bool IsPermanent() const {
return permanent_;
}
-
+/* LCOV_EXCL_START */
void SetFgSignal(bool fg_signal) {
fg_signal_ = fg_signal;
}
bool IsFgSignal() const {
return fg_signal_;
}
+/* LCOV_EXCL_STOP */
int SendUpdateStatus(const std::string& class_id,
const std::string& instance_id, int status, int err,
return 0;
}
+/* LCOV_EXCL_START */
void WidgetContext::Impl::OnUpdate(bool force) {
parent_->OnUpdate(pending_content_.empty() ? tizen_base::Bundle() :
tizen_base::Bundle(pending_content_), force);
WIDGET_INSTANCE_EVENT_UPDATE, 0, nullptr);
_D("Updated: %s", id.c_str());
}
+/* LCOV_EXCL_STOP */
void WidgetContext::Impl::UpdateProcess(const tizen_base::Bundle& b) {
bool force;
}
}
+/* LCOV_EXCL_START */
void WidgetContext::Impl::SetPeriod(double period) {
period_ = period;
}
TimedOutCb, parent_);
}
}
+/* LCOV_EXCL_STOP */
void WidgetContext::Impl::UnsetPeriodicTimer() {
if (periodic_timer_) {
}
}
+/* LCOV_EXCL_START */
gboolean WidgetContext::Impl::TimedOutCb(gpointer user_data) {
WidgetContext* wc = reinterpret_cast<WidgetContext*>(user_data);
if (wc->IsResumed()) {
return G_SOURCE_CONTINUE;
}
+/* LCOV_EXCL_STOP */
WidgetContext::WidgetContext(std::string context_id, std::string inst_id,
AppCoreMultiWindowBase* app)
WidgetContext::~WidgetContext() = default;
+/* LCOV_EXCL_START */
void WidgetContext::OnPause() {
std::string id = GetInstId();
_D("WidgetContext(%s) is paused", id.c_str());
__context.SetFgSignal(true);
}
}
+/* LCOV_EXCL_STOP */
void WidgetContext::OnResize(int w, int h) {
}
static void __call_update_cb(const char *class_id, const char *id, int force,
const char *content_raw);
+/* LCOV_EXCL_START */
static gboolean __timeout_cb(gpointer user_data)
{
widget_base_instance_data *data =
free(raw);
if (ret < 0) {
- /* LCOV_EXCL_START */
LOGE("failed to send content info: %s of %s (%d)", id,
class_id, ret);
return WIDGET_BASE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
}
return WIDGET_BASE_ERROR_NONE;
return c;
}
+/* LCOV_EXCL_STOP */
\ No newline at end of file
WidgetBase::OnTerminate();
return -1;
}
-
+/* LCOV_EXCL_START */
void OnLoopInit(int argc, char** argv) override {
elm_init(argc, argv);
}
void OnLoopRun() override {
elm_run();
}
-
+/* LCOV_EXCL_STOP */
void OnLoopExit() override {
elm_exit();
}
-
+/* LCOV_EXCL_START */
int OnTrimMemory() override {
_D("Trim memory");
elm_cache_all_flush();
return WidgetBase::OnTrimMemory();
}
-
+/* LCOV_EXCL_STOP */
private:
widget_app_lifecycle_callback_s* callback_;
void* user_data_;
}
private:
+/* LCOV_EXCL_START */
void SetIconifyTimer() {
if (iconify_timer_)
return;
return G_SOURCE_REMOVE;
}, this);
}
-
+/* LCOV_EXCL_STOP */
void UnsetIconifyTimer() {
if (iconify_timer_) {
g_source_remove(iconify_timer_);
}
if (callback->create == nullptr) {
- _E("widget_app_create_cb() callback must be registered");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("widget_app_create_cb() callback must be registered");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
try {
__app_widget->AddEvent(i);
__app_widget->Run(argc, argv);
- } catch (std::runtime_error& e) {
- return WIDGET_ERROR_FAULT;
+ } catch (std::runtime_error& e) {/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_FAULT;/* LCOV_EXCL_LINE */
}
return WIDGET_ERROR_NONE;
return WIDGET_ERROR_NOT_SUPPORTED;
if (context == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
return WIDGET_ERROR_NOT_SUPPORTED;
if (cb == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
if (__app_widget.get() == nullptr)
auto* app_event = new (std::nothrow) AppEvent(
::__app_event_converter[event_type], callback, user_data);
if (app_event == nullptr) {
- _E("Out of memory");
- return WIDGET_ERROR_OUT_OF_MEMORY;
+ _E("Out of memory");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_OUT_OF_MEMORY;/* LCOV_EXCL_LINE */
}
auto* h = new (std::nothrow) std::shared_ptr<AppEvent>(app_event);
if (h == nullptr) {
- _E("Out of memory");
- delete app_event;
- return WIDGET_ERROR_OUT_OF_MEMORY;
+ _E("Out of memory");/* LCOV_EXCL_LINE */
+ delete app_event;/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_OUT_OF_MEMORY;/* LCOV_EXCL_LINE */
}
if (__app_widget.get() != nullptr)
bool feature;
int ret = system_info_get_platform_bool(kFeatureShellAppWidget, &feature);
if (ret < 0) {
- set_last_result(WIDGET_ERROR_FAULT);
- return nullptr;
+ set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (!feature) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return nullptr;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (context == nullptr) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return nullptr;
+ set_last_result(WIDGET_ERROR_INVALID_PARAMETER);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
return WIDGET_ERROR_NOT_SUPPORTED;
if (context == nullptr || win == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
Ecore_Wl2_Window* wl_win = ecore_evas_wayland2_window_get(
ecore_evas_ecore_evas_get(evas_object_evas_get(ret_win)));
if (wl_win == nullptr) {
- _E("Failed to get wayland window");
- evas_object_del(ret_win);
- return WIDGET_ERROR_FAULT;
+ _E("Failed to get wayland window");/* LCOV_EXCL_LINE */
+ evas_object_del(ret_win);/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_FAULT;/* LCOV_EXCL_LINE */
}
ecore_wl2_window_class_set(wl_win, id.c_str());
bool feature;
int ret = system_info_get_platform_bool(kFeatureShellAppWidget, &feature);
if (ret < 0) {
- set_last_result(WIDGET_ERROR_FAULT);
- return nullptr;
+ set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (!feature) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return nullptr;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (class_id == nullptr || callback.create == nullptr) {
- _E("Invalid parameter");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return nullptr;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ set_last_result(WIDGET_ERROR_INVALID_PARAMETER);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (__app_widget.get() == nullptr) {
- set_last_result(WIDGET_ERROR_FAULT);
- return nullptr;
+ set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
auto factory = std::shared_ptr<AppCoreMultiWindowBase::Context::IFactory>(
new (std::nothrow) AppWidgetContext::Factory(
class_id, callback, user_data));
if (factory.get() == nullptr) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- return nullptr;
+ set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
__app_widget->AddContextFactory(std::move(factory), class_id);
bool feature;
int ret = system_info_get_platform_bool(kFeatureShellAppWidget, &feature);
if (ret < 0) {
- set_last_result(WIDGET_ERROR_FAULT);
- return nullptr;
+ set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (!feature) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return nullptr;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
if (callback.create == nullptr) {
- _E("Invalid parameter");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return nullptr;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ set_last_result(WIDGET_ERROR_INVALID_PARAMETER);/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
char* appid = nullptr;
app_get_id(&appid);
if (appid == nullptr) {
- LOGE("app_get_id() is failed");
- return nullptr;
+ LOGE("app_get_id() is failed");/* LCOV_EXCL_LINE */
+ return nullptr;/* LCOV_EXCL_LINE */
}
std::unique_ptr<char, decltype(std::free)*> ptr(appid, std::free);
return WIDGET_ERROR_NOT_SUPPORTED;
if (context == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
return WIDGET_ERROR_NOT_SUPPORTED;
if (context == nullptr || tag == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
return WIDGET_ERROR_NOT_SUPPORTED;
if (context == nullptr || content_info == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
ret = cxt->SetContents(tizen_base::Bundle(content_info));
if (ret != WIDGET_ERROR_NONE) {
- _E("Failed to set content");
- return static_cast<widget_error_e>(ret);
+ _E("Failed to set content");/* LCOV_EXCL_LINE */
+ return static_cast<widget_error_e>(ret);/* LCOV_EXCL_LINE */
}
return WIDGET_ERROR_NONE;
return WIDGET_ERROR_NOT_SUPPORTED;
if (context == nullptr || title == nullptr) {
- _E("Invalid parameter");
- return WIDGET_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");/* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
}
auto* cxt = reinterpret_cast<AppWidgetContext*>(context);
if (cxt->GetWindow())
- elm_win_title_set(cxt->GetWindow(), title);
+ elm_win_title_set(cxt->GetWindow(), title);/* LCOV_EXCL_LINE */
return WIDGET_ERROR_NONE;
}
int ret = -1;
try {
testing::InitGoogleTest(&argc, argv);
- } catch(...) {
- std::cout << "Exception occurred" << std::endl;
+ } catch(...) {/* LCOV_EXCL_LINE */
+ std::cout << "Exception occurred" << std::endl;/* LCOV_EXCL_LINE */
}
try {
ret = RUN_ALL_TESTS();
- } catch (const ::testing::internal::GoogleTestFailureException& e) {
- ret = -1;
- std::cout << "GoogleTestFailureException was thrown:" << e.what()
- << std::endl;
+ } catch (const ::testing::internal::GoogleTestFailureException& e) {/* LCOV_EXCL_LINE */
+ ret = -1;/* LCOV_EXCL_LINE */
+ std::cout << "GoogleTestFailureException was thrown:" << e.what()/* LCOV_EXCL_LINE */
+ << std::endl;/* LCOV_EXCL_LINE */
}
return ret;
return MOCK_HOOK_P0(EcoreWl2Mock, ecore_wl2_init);
}
-extern "C" Ecore_Wl2_Display* ecore_wl2_connected_display_get(
- const char *display) {
- return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_connected_display_get, display);
-}
-
-extern "C" void ecore_wl2_window_iconified_set(
- Ecore_Wl2_Window *win, Eina_Bool flag) {
- return MOCK_HOOK_P2(EcoreWl2Mock, ecore_wl2_window_iconified_set, win, flag);
-}
-
extern "C" void ecore_wl2_window_class_set(
Ecore_Wl2_Window *win, const char *name) {
return MOCK_HOOK_P2(EcoreWl2Mock, ecore_wl2_window_class_set, win, name);
return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_window_id_get, win);
}
-extern "C" void ecore_wl2_display_disconnect(
- Ecore_Wl2_Display *display) {
- return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_display_disconnect, display);
-}
-
-extern "C" int ecore_wl2_shutdown() {
- return MOCK_HOOK_P0(EcoreWl2Mock, ecore_wl2_shutdown);
-}
-
-extern "C" Ecore_Wl2_Display *ecore_wl2_display_connect(const char *conn) {
- return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_display_connect, conn);
-}
-
extern "C" Ecore_Wl2_Window *ecore_evas_wayland2_window_get(const Ecore_Evas *ee) {
return MOCK_HOOK_P1(EcoreWl2Mock, ecore_evas_wayland2_window_get, ee);
}
return MOCK_HOOK_P1(EcoreWl2Mock, evas_object_evas_get, eo_obj);
}
-extern "C" void evas_object_del(Evas_Object *obj) {
- return MOCK_HOOK_P1(EcoreWl2Mock, evas_object_del, obj);
-}
-
extern "C" struct wl_surface *ecore_wl2_window_surface_get(Ecore_Wl2_Window *window) {
return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_window_surface_get, window);
}
MOCK_METHOD0(ecore_wl2_init,
int());
- MOCK_METHOD1(ecore_wl2_connected_display_get,
- Ecore_Wl2_Display*(const char *));
- MOCK_METHOD2(ecore_wl2_window_iconified_set,
- void(Ecore_Wl2_Window *, Eina_Bool));
MOCK_METHOD2(ecore_wl2_window_class_set,
void(Ecore_Wl2_Window *, const char *));
MOCK_METHOD1(ecore_wl2_window_id_get,
int(Ecore_Wl2_Window *));
- MOCK_METHOD1(ecore_wl2_display_disconnect,
- void(Ecore_Wl2_Display *));
- MOCK_METHOD0(ecore_wl2_shutdown,
- int());
- MOCK_METHOD1(ecore_wl2_display_connect,
- Ecore_Wl2_Display *(const char *));
MOCK_METHOD1(ecore_evas_wayland2_window_get,
Ecore_Wl2_Window *(const Ecore_Evas *));
MOCK_METHOD1(ecore_evas_ecore_evas_get,
Ecore_Evas *(const Evas *));
MOCK_METHOD1(evas_object_evas_get,
Evas *(const Eo *));
- MOCK_METHOD1(evas_object_del,
- void (Evas_Object *));
MOCK_METHOD1(ecore_wl2_window_surface_get,
struct wl_surface *(Ecore_Wl2_Window *));
MOCK_METHOD3(evas_object_data_set,
+++ /dev/null
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "unit_tests/mock/gio_mock.h"
-
-#include <gio/gio.h>
-
-#include "unit_tests/mock/mock_hook.h"
-#include "unit_tests/mock/test_fixture.h"
-
-extern "C" GDBusConnection* g_bus_get_sync(GBusType type,
- GCancellable* cancellable, GError** error) {
- return MOCK_HOOK_P3(GioMock, g_bus_get_sync, type, cancellable, error);
-}
-
-extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_sync(
- GDBusConnection* conn, GDBusMessage* msg, GDBusSendMessageFlags flags,
- gint timeout, volatile guint32* out_serial, GCancellable* cancellable,
- GError** error) {
- return MOCK_HOOK_P7(GioMock, g_dbus_connection_send_message_with_reply_sync,
- conn, msg, flags, timeout, out_serial, cancellable, error);
-}
-
-extern "C" GDBusMessage* g_dbus_message_new_method_call(const gchar* arg0,
- const gchar* arg1, const gchar* arg2, const gchar* arg3) {
- return MOCK_HOOK_P4(GioMock, g_dbus_message_new_method_call, arg0, arg1, arg2,
- arg3);
-}
-
-extern "C" void g_dbus_message_set_body(GDBusMessage* arg0, GVariant* arg1) {
- return MOCK_HOOK_P2(GioMock, g_dbus_message_set_body, arg0, arg1);
-}
-
-extern "C" GVariant* g_dbus_message_get_body(GDBusMessage* arg0) {
- return MOCK_HOOK_P1(GioMock, g_dbus_message_get_body, arg0);
-}
-
-extern "C" gboolean g_dbus_connection_emit_signal(GDBusConnection* arg0,
- const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
- GVariant* arg5, GError** arg6) {
- return MOCK_HOOK_P7(GioMock, g_dbus_connection_emit_signal,
- arg0, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-extern "C" GDBusNodeInfo* g_dbus_node_info_new_for_xml(
- const gchar* arg0, GError** arg1) {
- return MOCK_HOOK_P2(GioMock, g_dbus_node_info_new_for_xml, arg0, arg1);
-}
-
-extern "C" guint g_dbus_connection_register_object(GDBusConnection* arg0,
- const gchar* arg1, GDBusInterfaceInfo* arg2,
- const GDBusInterfaceVTable* arg3, gpointer arg4,
- GDestroyNotify arg5, GError** arg6) {
- return MOCK_HOOK_P7(GioMock, g_dbus_connection_register_object,
- arg0, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-extern "C" guint g_bus_own_name_on_connection(GDBusConnection* arg0,
- const gchar* arg1, GBusNameOwnerFlags arg2,
- GBusNameAcquiredCallback arg3, GBusNameLostCallback arg4,
- gpointer arg5, GDestroyNotify arg6) {
- return MOCK_HOOK_P7(GioMock, g_bus_own_name_on_connection,
- arg0, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-extern "C" guint g_dbus_connection_signal_subscribe(GDBusConnection* arg0,
- const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
- const gchar* arg5, GDBusSignalFlags arg6, GDBusSignalCallback arg7,
- gpointer arg8, GDestroyNotify arg9) {
- return MOCK_HOOK_P10(GioMock, g_dbus_connection_signal_subscribe,
- arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-}
-
-extern "C" void g_dbus_connection_send_message_with_reply(GDBusConnection* arg0,
- GDBusMessage* arg1, GDBusSendMessageFlags arg2, gint arg3,
- volatile guint32* arg4, GCancellable* arg5, GAsyncReadyCallback arg6,
- gpointer arg7) {
- return MOCK_HOOK_P8(GioMock, g_dbus_connection_send_message_with_reply,
- arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-}
-
-extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_finish(
- GDBusConnection* arg0, GAsyncResult* arg1, GError** arg2) {
- return MOCK_HOOK_P3(GioMock, g_dbus_connection_send_message_with_reply_finish,
- arg0, arg1, arg2);
-}
+++ /dev/null
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef UNIT_TESTS_MOCK_GIO_MOCK_H_
-#define UNIT_TESTS_MOCK_GIO_MOCK_H_
-
-#include <gio/gio.h>
-#include <gmock/gmock.h>
-
-#include "mock/module_mock.h"
-
-class GioMock : public virtual ModuleMock {
- public:
- virtual ~GioMock() {}
-
- MOCK_METHOD3(g_bus_get_sync,
- GDBusConnection*(GBusType, GCancellable*, GError**));
- MOCK_METHOD7(g_bus_own_name_on_connection,
- guint(GDBusConnection*, const gchar*, GBusNameOwnerFlags,
- GBusNameAcquiredCallback, GBusNameLostCallback,
- gpointer, GDestroyNotify));
-
- MOCK_METHOD4(g_dbus_message_new_method_call,
- GDBusMessage*(const gchar*, const gchar*, const gchar*, const gchar*));
- MOCK_METHOD2(g_dbus_message_set_body, void(GDBusMessage*, GVariant*));
- MOCK_METHOD1(g_dbus_message_get_body, GVariant*(GDBusMessage*));
-
- MOCK_METHOD7(g_dbus_connection_send_message_with_reply_sync,
- GDBusMessage*(GDBusConnection*, GDBusMessage*, GDBusSendMessageFlags,
- gint, volatile guint32*, GCancellable*, GError**));
- MOCK_METHOD7(g_dbus_connection_emit_signal,
- gboolean(GDBusConnection*, const gchar*, const gchar*, const gchar*,
- const gchar*, GVariant*, GError**));
- MOCK_METHOD7(g_dbus_connection_register_object,
- guint(GDBusConnection*, const gchar*, GDBusInterfaceInfo*,
- const GDBusInterfaceVTable*, gpointer, GDestroyNotify, GError**));
- MOCK_METHOD10(g_dbus_connection_signal_subscribe,
- guint(GDBusConnection*, const gchar*, const gchar*, const gchar*,
- const gchar*, const gchar*, GDBusSignalFlags, GDBusSignalCallback,
- gpointer, GDestroyNotify));
- MOCK_METHOD8(g_dbus_connection_send_message_with_reply,
- void(GDBusConnection*, GDBusMessage*, GDBusSendMessageFlags, gint,
- volatile guint32*, GCancellable*, GAsyncReadyCallback, gpointer));
- MOCK_METHOD3(g_dbus_connection_send_message_with_reply_finish,
- GDBusMessage*(GDBusConnection*, GAsyncResult*, GError**));
-
- MOCK_METHOD2(g_dbus_node_info_new_for_xml,
- GDBusNodeInfo*(const gchar*, GError**));
-
- MOCK_METHOD2(g_dbus_method_invocation_return_value,
- GDBusNodeInfo*(GDBusMethodInvocation*, GVariant*));
-};
-
-#endif // UNIT_TESTS_MOCK_GIO_MOCK_H_
#include <memory>
#include "include/widget_app.h"
+#include "include/widget_app_internal.h"
#include "include/widget_app_efl.h"
#include "unit_tests/mock/app_common_mock.h"
#include "unit_tests/mock/appcore_multiwindow_base_mock.h"
#include "unit_tests/mock/aul_mock.h"
#include "unit_tests/mock/ecore_wl2_mock.h"
#include "unit_tests/mock/elm_mock.h"
-#include "unit_tests/mock/gio_mock.h"
#include "unit_tests/mock/system_info_mock.h"
#include "unit_tests/mock/test_fixture.h"
#include "unit_tests/mock/widget_service_mock.h"
return 0;
}
+/* LCOV_EXCL_START */
int __instance_pause_cb(widget_context_h context, void* user_data) {
return 0;
}
return 0;
}
-int __instance_resize_cb(widget_context_h context,
- int w, int h, void* user_data) {
+int __instance_update_cb(widget_context_h context,
+ bundle* content, int force, void* user_data) {
return 0;
}
+/* LCOV_EXCL_STOP */
-int __instance_update_cb(widget_context_h context,
- bundle* content, int force, void* user_data) {
+int __instance_resize_cb(widget_context_h context,
+ int w, int h, void* user_data) {
return 0;
}
snprintf(pkgid, len, "%s", "test");
return 0;
}
-
+/* LCOV_EXCL_START */
void __app_event_cb(app_event_info_h event_info, void *user_data) {
}
bool __widget_context_cb(widget_context_h context, void *user_data) {
return true;
}
-
+/* LCOV_EXCL_STOP */
} // namespace
-class Mocks : public ::testing::NiceMock<GioMock>,
- public ::testing::NiceMock<MultiWindowBaseMock>,
+class Mocks : public ::testing::NiceMock<MultiWindowBaseMock>,
public ::testing::NiceMock<AppCommonMock>,
public ::testing::NiceMock<WidgetServiceMock>,
public ::testing::NiceMock<ElmMock>,
b.Add("__WIDGET_OP__", "period");
p->OnControl(b);
+ p->OnReceive(AUL_WIDGET_CONTENT, b);
+
p->OnTerminate();
}
};
});
}
+TEST_F(WidgetAppTest, widget_app_restart) {
+ PrepareContext(
+ [](widget_context_h context, bundle* content,
+ int w, int h, void* user_data) -> int {
+ EXPECT_CALL(GetMock<AulMock>(),
+ aul_notify_exit()).WillRepeatedly(Return(0));
+ widget_app_exit();
+ widget_app_restart();
+ return 0;
+ });
+}
+
TEST_F(WidgetAppTest, widget_app_add_event_handler) {
app_event_handler_h handle;
EXPECT_CALL(GetMock<SystemInfoMock>(),
#include "unit_tests/mock/aul_mock.h"
#include "unit_tests/mock/ecore_wl2_mock.h"
#include "unit_tests/mock/elm_mock.h"
-#include "unit_tests/mock/gio_mock.h"
#include "unit_tests/mock/system_info_mock.h"
#include "unit_tests/mock/test_fixture.h"
#include "unit_tests/mock/widget_service_mock.h"
using ::testing::Return;
using ::testing::SetArgPointee;
-class Mocks : public ::testing::NiceMock<GioMock>,
- public ::testing::NiceMock<MultiWindowBaseMock>,
+class Mocks : public ::testing::NiceMock<MultiWindowBaseMock>,
public ::testing::NiceMock<AppCommonMock>,
public ::testing::NiceMock<WidgetServiceMock>,
public ::testing::NiceMock<ElmMock>,
};
explicit Instance(widget_context_h h) : InstanceBase(h) {}
+/* LCOV_EXCL_START */
void OnCreate(const tizen_base::Bundle& content, int w, int h) override {}
void OnDestroy(DestroyType reason, tizen_base::Bundle* content) override {}
void OnPause() override {}
void OnResume() override {}
void OnResize(int w, int h) override {}
void OnUpdate(const tizen_base::Bundle& content, bool force) override {}
+/* LCOV_EXCL_STOP */
};
WidgetApp() {}
std::unique_ptr<tizen_appfw::WidgetAppBase::InstanceBase::Factory> factory(
new WidgetApp::Instance::Factory());
+ widget_context_h h = nullptr;
+ factory->Create(h);
+ app.OnCreate();
int ret = app.Run(0, nullptr, std::move(factory));
EXPECT_EQ(ret, APP_ERROR_INVALID_PARAMETER);
+ app.OnTerminate();
}
+
+TEST_F(WidgetAppCppTest, NullInstance) {
+ EXPECT_CALL(GetMock<SystemInfoMock>(),
+ system_info_get_platform_bool(_, _)).
+ WillRepeatedly(DoAll(SetArgPointee<1>(true), Return(0)));
+
+ widget_context_h h = nullptr;
+ std::unique_ptr<tizen_appfw::WidgetAppBase::InstanceBase> inst(
+ new WidgetApp::Instance(h));
+
+ widget_context_h ret_h = inst->GetHandle();
+ EXPECT_EQ(ret_h, nullptr);
+}
\ No newline at end of file