*/
#include "libds-tests.h"
+#include <wayland-extension/tizen-launch-client-protocol.h>
#include "DSWaylandTizenAppinfo.h"
+#include "DSTizenAppinfoMgr.h"
using namespace display_server;
DSWaylandCompositor::releaseInstance();
}
+TEST_F(DSWaylandTizenAppinfoTest, New_Appinfo_with_AppinfoMgr)
+{
+ DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
+ DSTizenAppinfoMgr *dsAppinfoMgr = DSTizenAppinfoMgr::getInstance();
+ DSWaylandTizenAppinfo *tzAppinfo = new DSWaylandTizenAppinfo(compositor, dsAppinfoMgr);
+ EXPECT_TRUE(tzAppinfo != nullptr);
+
+ if (tzAppinfo)
+ delete tzAppinfo;
+
+ DSTizenAppinfoMgr::releaseInstance();
+ DSWaylandCompositor::releaseInstance();
+}
+
TEST_F(DSWaylandTizenAppinfoTest, Initialize_Appinfo)
{
bool ret;
DSWaylandCompositor::releaseInstance();
}
+
+static struct tizen_launch_appinfo *tz_appinfo = nullptr;
+
+static void
+handle_global(void *data, struct wl_registry *registry, uint32_t name,
+ const char *interface, uint32_t version)
+{
+ struct TestClient *testClient = (struct TestClient *)data;
+
+ if (strcmp(interface, "wl_compositor") == 0) {
+ testClient->compositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 1);
+ if (!testClient->compositor)
+ DSLOG_ERR("TEST", "wl_registry_bind compositor fails.");
+ }
+ else if(strcmp(interface, "tizen_launch_appinfo") == 0)
+ {
+ const char * appId = "com.samsung.clocksetting";
+
+ tz_appinfo = (struct tizen_launch_appinfo *)wl_registry_bind(registry, name, &tizen_launch_appinfo_interface, 1);
+
+ tizen_launch_appinfo_register_appid(tz_appinfo, appId);
+ tizen_launch_appinfo_set_pid(tz_appinfo, appId, 4077);
+ tizen_launch_appinfo_deregister_appid(tz_appinfo, appId);
+ }
+}
+
+static void
+handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{}
+
+static const struct wl_registry_listener registry_listener = {
+ handle_global,
+ handle_global_remove
+};
+TEST_F(DSWaylandTizenAppinfoTest, testRequest_Appinfo)
+{
+ auto mockWaylandCompositor = std::make_unique<MockWaylandCompositor>();
+
+ Ecore_Timer *serverQuitTimer = nullptr;
+ double severQuitTime = 1.0;
+ auto serverQuitFunc = [](void *data) -> Eina_Bool {
+ MockWaylandCompositor *comp = (MockWaylandCompositor *)data;
+
+ // quit server
+ comp->quit();
+ // check the emitting the surfaceCreated
+ EXPECT_TRUE(tz_appinfo != nullptr);
+
+ return EINA_FALSE;
+ };
+ serverQuitTimer = ecore_timer_loop_add(severQuitTime, serverQuitFunc, mockWaylandCompositor.get());
+ EXPECT_TRUE(serverQuitTimer != nullptr);
+
+ // create the wayland client which creates the wl_surface.
+ std::future<bool> clientThread = std::async(std::launch::async, []() -> bool {
+ std::this_thread::sleep_for(std::chrono::milliseconds(40));
+ auto testClient = std::make_shared<TestClient>();
+
+ testClient->display = wl_display_connect(NULL);
+ EXPECT_TRUE(testClient->display != nullptr);
+
+ testClient->registry = wl_display_get_registry(testClient->display);
+ wl_registry_add_listener(testClient->registry, ®istry_listener, testClient.get());
+ wl_display_dispatch(testClient->display);
+ wl_display_roundtrip(testClient->display);
+ EXPECT_TRUE(testClient->compositor != nullptr);
+
+ wl_display_disconnect(testClient->display);
+
+ return true;
+ }
+ );
+
+ mockWaylandCompositor->run();
+ EXPECT_TRUE(clientThread.get()); // join(wait) and get the return value.
+}
ecore_dep = dependency('ecore', method : 'pkg-config')
wl_client_dep = dependency('wayland-client', method : 'pkg-config')
wl_tbm_dep = dependency('wayland-tbm-client', method : 'pkg-config')
+tizen_launch_client_dep = dependency('tizen-launch-client')
executable(
'libds-tests',
libds_tests_srcs,
- dependencies : [libds_declared_dep, gmock_dep, ecore_dep, ecore_evas_dep, wl_client_dep, wl_tbm_dep],
+ dependencies : [libds_declared_dep, gmock_dep, ecore_dep, ecore_evas_dep, wl_client_dep, wl_tbm_dep, tizen_launch_client_dep],
install_dir : libds_prefix_bindir,
install : true
)