launch: merge header files in one (launch.h)
[platform/core/uifw/libds-tizen.git] / tests / tc_launch_appinfo.cpp
index 9e7bab1..15630d6 100644 (file)
@@ -1,17 +1,17 @@
 #include "tc_main.h"
 #include "mockclient.h"
 #include "mockcompositor.h"
-#include <libds-tizen/launch/appinfo.h>
+#include <libds-tizen/launch.h>
 #include <tizen-launch-server-protocol.h>
 #include <tizen-launch-client-protocol.h>
 
 #define TIZEN_APPINFO_VERSION 1
 
-class MockAppinfoCompositor : public MockCompositor
+class MockLaunchAppinfoCompositor : public MockCompositor
 {
 public:
-    MockAppinfoCompositor()
-        : MockCompositor(&MockAppinfoCompositor::TestSetup, this)
+    MockLaunchAppinfoCompositor()
+        : MockCompositor(&MockLaunchAppinfoCompositor::TestSetup, this)
     {
         ds_inf("%s : this(%p)", __func__, this);
 
@@ -23,47 +23,47 @@ public:
         bMetadataReady = false;
     }
 
-    ~MockAppinfoCompositor()
+    ~MockLaunchAppinfoCompositor()
     {
         ds_inf("%s : this(%p)", __func__, this);
     }
 
     static void TestSetup(void *data)
     {
-        MockAppinfoCompositor *mockComp =
-            static_cast<MockAppinfoCompositor *>(data);
+        MockLaunchAppinfoCompositor *mockComp =
+            static_cast<MockLaunchAppinfoCompositor *>(data);
         Compositor *comp = mockComp->compositor;
 
         ds_inf("%s: mockComp(%p)", __func__, mockComp);
 
-        mockComp->mAppinfoMgr = ds_tizen_appinfo_mgr_create(comp->display);
+        mockComp->mAppinfoMgr = ds_tizen_launch_appinfo_mgr_create(comp->display);
 
         // destroy listener
         mockComp->mDestroyListener.notify =
-            MockAppinfoCompositor::DestroyCallback;
+            MockLaunchAppinfoCompositor::DestroyCallback;
         mockComp->mDestroyListener.parent = mockComp;
-        ds_tizen_appinfo_mgr_add_destroy_listener(mockComp->mAppinfoMgr,
+        ds_tizen_launch_appinfo_mgr_add_destroy_listener(mockComp->mAppinfoMgr,
             &mockComp->mDestroyListener);
 
         // set_pid listener
         mockComp->mSetPidListener.notify =
-            MockAppinfoCompositor::SetPidCallback;
+            MockLaunchAppinfoCompositor::SetPidCallback;
         mockComp->mSetPidListener.parent = mockComp;
-        ds_tizen_appinfo_mgr_add_set_pid_listener(mockComp->mAppinfoMgr,
+        ds_tizen_launch_appinfo_mgr_add_set_pid_listener(mockComp->mAppinfoMgr,
             &mockComp->mSetPidListener);
 
         // set_appid listener
         mockComp->mSetAppidListener.notify =
-            MockAppinfoCompositor::SetAppidCallback;
+            MockLaunchAppinfoCompositor::SetAppidCallback;
         mockComp->mSetAppidListener.parent = mockComp;
-        ds_tizen_appinfo_mgr_add_set_appid_listener(mockComp->mAppinfoMgr,
+        ds_tizen_launch_appinfo_mgr_add_set_appid_listener(mockComp->mAppinfoMgr,
             &mockComp->mSetAppidListener);
 
         // metadata_ready listener
         mockComp->mMetadataReadyListener.notify =
-            MockAppinfoCompositor::MetadataReadyCallback;
+            MockLaunchAppinfoCompositor::MetadataReadyCallback;
         mockComp->mMetadataReadyListener.parent = mockComp;
-        ds_tizen_appinfo_mgr_add_metadata_ready_listener(
+        ds_tizen_launch_appinfo_mgr_add_metadata_ready_listener(
             mockComp->mAppinfoMgr,
             &mockComp->mMetadataReadyListener);
     }
@@ -72,7 +72,7 @@ public:
     {
         ds_inf("%s", __func__);
 
-        MockAppinfoCompositor *mockComp =
+        MockLaunchAppinfoCompositor *mockComp =
             reinterpret_cast<DestroyListener *>(listener)->parent;
 
         mockComp->bDestroyed = true;
@@ -82,9 +82,9 @@ public:
     {
         ds_inf("%s", __func__);
 
-        MockAppinfoCompositor *mockComp =
+        MockLaunchAppinfoCompositor *mockComp =
             reinterpret_cast<SetPidListener *>(listener)->parent;
-        struct ds_tizen_appinfo *info = static_cast<struct ds_tizen_appinfo *>(data);
+        struct ds_tizen_launch_appinfo *info = static_cast<struct ds_tizen_launch_appinfo *>(data);
 
         ds_inf("%s: mockComp(%p), appinfo(%p)", __func__, mockComp, info);
 
@@ -95,9 +95,9 @@ public:
     {
         ds_inf("%s", __func__);
 
-        MockAppinfoCompositor *mockComp =
+        MockLaunchAppinfoCompositor *mockComp =
             reinterpret_cast<SetAppidListener *>(listener)->parent;
-        struct ds_tizen_appinfo *info = static_cast<struct ds_tizen_appinfo *>(data);
+        struct ds_tizen_launch_appinfo *info = static_cast<struct ds_tizen_launch_appinfo *>(data);
 
         ds_inf("%s: mockComp(%p), appinfo(%p)", __func__, mockComp, info);
 
@@ -109,9 +109,9 @@ public:
     {
         ds_inf("%s", __func__);
 
-        MockAppinfoCompositor *mockComp =
+        MockLaunchAppinfoCompositor *mockComp =
             reinterpret_cast<MetadataReadyListener *>(listener)->parent;
-        struct ds_tizen_appinfo *info = static_cast<struct ds_tizen_appinfo *>(data);
+        struct ds_tizen_launch_appinfo *info = static_cast<struct ds_tizen_launch_appinfo *>(data);
 
         ds_inf("%s: mockComp(%p), appinfo(%p)", __func__, mockComp, info);
 
@@ -122,7 +122,7 @@ public:
     {
         ds_inf("%s", __func__);
 
-        wl_resource *res_appinfo = ds_tizen_appinfo_mgr_get_appinfo_resource(mAppinfoMgr);
+        wl_resource *res_appinfo = ds_tizen_launch_appinfo_mgr_get_appinfo_resource(mAppinfoMgr);
 
         tizen_launch_appinfo_send_base_output_resolution_done(res_appinfo, pid, width, height);
     }
@@ -134,36 +134,36 @@ public:
     bool bMetadataReady;
 
 private:
-    struct ds_tizen_appinfo_mgr *mAppinfoMgr;
+    struct ds_tizen_launch_appinfo_mgr *mAppinfoMgr;
     struct DestroyListener: ::wl_listener {
-        MockAppinfoCompositor *parent;
+        MockLaunchAppinfoCompositor *parent;
     };
     DestroyListener mDestroyListener;
     struct SetPidListener: ::wl_listener {
-        MockAppinfoCompositor *parent;
+        MockLaunchAppinfoCompositor *parent;
     };
     SetPidListener mSetPidListener;
     struct SetAppidListener: ::wl_listener {
-        MockAppinfoCompositor *parent;
+        MockLaunchAppinfoCompositor *parent;
     };
     SetAppidListener mSetAppidListener;
     struct MetadataReadyListener: ::wl_listener {
-        MockAppinfoCompositor *parent;
+        MockLaunchAppinfoCompositor *parent;
     };
     MetadataReadyListener mMetadataReadyListener;
 };
 
-class MockAppinfoClient : public MockClient
+class MockLaunchAppinfoClient : public MockClient
 {
 public:
-    MockAppinfoClient()
+    MockLaunchAppinfoClient()
         : bBaseOutputResolutionDone(false),
           mBaseOutputResolutionWidth(0),
           mBaseOutputResolutionHeight(0),
           compositor_res(nullptr),
           tizen_launch_appinfo(nullptr)
     {}
-    MockAppinfoClient(const struct wl_registry_listener *listener)
+    MockLaunchAppinfoClient(const struct wl_registry_listener *listener)
         : MockClient(listener, this)
     {
         ds_inf("%s", __func__);
@@ -172,7 +172,7 @@ public:
         mBaseOutputResolutionWidth = 0;
         mBaseOutputResolutionHeight = 0;
     }
-    ~MockAppinfoClient()
+    ~MockLaunchAppinfoClient()
     {
         ds_inf("%s", __func__);
     }
@@ -191,13 +191,13 @@ public:
         return compositor_res;
     }
 
-    void SetTizenAppinfo(struct tizen_launch_appinfo *global_res)
+    void SetTizenLaunchAppinfo(struct tizen_launch_appinfo *global_res)
     {
         ds_inf("%s", __func__);
         tizen_launch_appinfo = global_res;
     }
 
-    struct tizen_launch_appinfo *GetTizenAppinfo()
+    struct tizen_launch_appinfo *GetTizenLaunchAppinfo()
     {
         ds_inf("%s", __func__);
 
@@ -221,7 +221,7 @@ client_tizen_appinfo_cb_base_output_resolution_done(void *data,
 {
     ds_inf("%s", __func__);
 
-    MockAppinfoClient *client = static_cast<MockAppinfoClient *>(data);
+    MockLaunchAppinfoClient *client = static_cast<MockLaunchAppinfoClient *>(data);
 
     client->bBaseOutputResolutionDone = true;
     client->mBaseOutputResolutionWidth = width;
@@ -238,7 +238,7 @@ client_registry_cb_global(void *data, struct wl_registry *registry,
 {
     ds_inf("%s", __func__);
 
-    MockAppinfoClient *client = static_cast<MockAppinfoClient *>(data);
+    MockLaunchAppinfoClient *client = static_cast<MockLaunchAppinfoClient *>(data);
     struct wl_compositor *compositor_res;
     struct tizen_launch_appinfo *tizen_launch_appinfo;
 
@@ -257,7 +257,7 @@ client_registry_cb_global(void *data, struct wl_registry *registry,
             ds_err("wl_registry_bind() failed. tizen_launch_appinfo resource.");
             return;
         }
-        client->SetTizenAppinfo(tizen_launch_appinfo);
+        client->SetTizenLaunchAppinfo(tizen_launch_appinfo);
 
         tizen_launch_appinfo_add_listener(tizen_launch_appinfo, &appinfo_cb_listener,
             client);
@@ -270,9 +270,9 @@ client_registry_cb_global_remove(void *data, struct wl_registry *registry,
 {
     ds_inf("%s", __func__);
 
-    MockAppinfoClient *client = static_cast<MockAppinfoClient *>(data);
+    MockLaunchAppinfoClient *client = static_cast<MockLaunchAppinfoClient *>(data);
     struct wl_compositor *compositor_res = client->GetWlCompositor();
-    struct tizen_launch_appinfo *appinfo_res = client->GetTizenAppinfo();
+    struct tizen_launch_appinfo *appinfo_res = client->GetTizenLaunchAppinfo();
 
     tizen_launch_appinfo_destroy(appinfo_res);
     wl_compositor_destroy(compositor_res);
@@ -283,33 +283,33 @@ static const struct wl_registry_listener registry_listener = {
     .global_remove = client_registry_cb_global_remove
 };
 
-class AppinfoTest : public ::testing::Test
+class LaunchAppinfoTest : public ::testing::Test
 {
 public:
     void SetUp(void) override;
     void TearDown(void) override;
 
-    MockAppinfoCompositor *comp;
-    MockAppinfoClient *client;
+    MockLaunchAppinfoCompositor *comp;
+    MockLaunchAppinfoClient *client;
     struct wl_compositor *compositor_res;
     struct tizen_launch_appinfo *appinfo_res;
 };
 
 void
-AppinfoTest::SetUp(void)
+LaunchAppinfoTest::SetUp(void)
 {
     ds_inf("%s", __func__);
 
-    comp = new MockAppinfoCompositor();
-    client = new MockAppinfoClient(&registry_listener);
+    comp = new MockLaunchAppinfoCompositor();
+    client = new MockLaunchAppinfoClient(&registry_listener);
     compositor_res = client->GetWlCompositor();
-    appinfo_res = client->GetTizenAppinfo();
+    appinfo_res = client->GetTizenLaunchAppinfo();
 
     client->RoundTrip();
 }
 
 void
-AppinfoTest::TearDown(void)
+LaunchAppinfoTest::TearDown(void)
 {
     ds_inf("%s", __func__);
 
@@ -319,12 +319,12 @@ AppinfoTest::TearDown(void)
     delete comp;
 }
 
-TEST_F(AppinfoTest, Create_P)
+TEST_F(LaunchAppinfoTest, Create_P)
 {
     EXPECT_TRUE(true);
 }
 
-TEST_F(AppinfoTest, Req_TizenAppinfoRegisterPid)
+TEST_F(LaunchAppinfoTest, Req_TizenLaunchAppinfoRegisterPid)
 {
     uint32_t pid = 1234;
 
@@ -333,7 +333,7 @@ TEST_F(AppinfoTest, Req_TizenAppinfoRegisterPid)
     EXPECT_TRUE(comp->bSetPid);
 }
 
-TEST_F(AppinfoTest, Req_TizenAppinfoSetAppid)
+TEST_F(LaunchAppinfoTest, Req_TizenLaunchAppinfoSetAppid)
 {
     uint32_t pid = 1234;
     const char *appid = "org.tizen.libds-tizen-appinfo-test";
@@ -347,7 +347,7 @@ TEST_F(AppinfoTest, Req_TizenAppinfoSetAppid)
     EXPECT_TRUE(comp->bSetAppid);
 }
 
-TEST_F(AppinfoTest, Req_TizenAppinfoRegisterAppid)
+TEST_F(LaunchAppinfoTest, Req_TizenLaunchAppinfoRegisterAppid)
 {
     const char *appid = "org.tizen.libds-tizen-appinfo-test";
 
@@ -356,7 +356,7 @@ TEST_F(AppinfoTest, Req_TizenAppinfoRegisterAppid)
     EXPECT_TRUE(comp->bSetAppid);
 }
 
-TEST_F(AppinfoTest, Req_TizenAppinfoSetPid)
+TEST_F(LaunchAppinfoTest, Req_TizenLaunchAppinfoSetPid)
 {
     uint32_t pid = 1234;
     const char *appid = "org.tizen.libds-tizen-appinfo-test";
@@ -370,7 +370,7 @@ TEST_F(AppinfoTest, Req_TizenAppinfoSetPid)
     EXPECT_TRUE(comp->bSetPid);
 }
 
-TEST_F(AppinfoTest, Req_TizenAppinfoMetadataReady)
+TEST_F(LaunchAppinfoTest, Req_TizenLaunchAppinfoMetadataReady)
 {
     const char *appid = "org.tizen.libds-tizen-appinfo-test";
     uint32_t pid = 1234;
@@ -384,7 +384,7 @@ TEST_F(AppinfoTest, Req_TizenAppinfoMetadataReady)
     EXPECT_TRUE(comp->bMetadataReady);
 }
 
-TEST_F(AppinfoTest, Req_TizenAppinfoGetBaseOutputResolution)
+TEST_F(LaunchAppinfoTest, Req_TizenLaunchAppinfoGetBaseOutputResolution)
 {
     uint32_t pid = 1234;
 
@@ -400,7 +400,7 @@ TEST_F(AppinfoTest, Req_TizenAppinfoGetBaseOutputResolution)
     EXPECT_TRUE(client->mBaseOutputResolutionHeight == 1920); // default value
 }
 
-TEST_F(AppinfoTest, Ev_TizenAppinfoBaseOutputResolutionDone)
+TEST_F(LaunchAppinfoTest, Ev_TizenLaunchAppinfoBaseOutputResolutionDone)
 {
     uint32_t pid = 1234, width = 1920, height = 1080;