Add flag for mockup 30/230830/2
authorJunghoon Park <jh9216.park@samsung.com>
Tue, 14 Apr 2020 11:29:56 +0000 (20:29 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Mon, 20 Apr 2020 08:59:48 +0000 (17:59 +0900)
Change-Id: I855b9eb607ae425d650deaa7467b6ab46ed16b73
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
screen_connector_remote_surface/remote_surface.cc
screen_connector_remote_surface_evas/remote_surface_evas.cc
screen_connector_remote_surface_evas/remote_surface_watcher.cc
screen_connector_remote_surface_evas/remote_surface_watcher.h
screen_connector_remote_surface_evas/remote_surface_watcher_implementation.h
screen_connector_remote_surface_evas/util.cc
screen_connector_remote_surface_evas/util.h

index c277b7e..d24ab9c 100644 (file)
@@ -145,6 +145,8 @@ RemoteSurface::RemoteSurface(const std::string& id, Type type,
 RemoteSurface::RemoteSurface(int rid, const std::string& id,
                     Type type, std::shared_ptr<WlSurface> wl_surface, bool mock)
     : impl_(new Impl(this, rid, id, type, std::move(wl_surface), mock)) {
+  if (mock)
+    return;
   impl_->Redirect();
 }
 
index 008ec9a..07d21f9 100644 (file)
@@ -39,7 +39,7 @@ RemoteSurfaceEvas::RemoteSurfaceEvas(const std::string& id,
                                      RemoteSurface::Type type,
                                      std::shared_ptr<EvasObject> viewerWin,
                                      bool mock)
-    : RemoteSurface(id, type, util::GetWlSurface(*viewerWin.get()), mock),
+    : RemoteSurface(id, type, util::GetWlSurface(*viewerWin.get(), mock), mock),
       impl_(new Impl(this, viewerWin, mock)) {
 }
 
@@ -47,7 +47,7 @@ RemoteSurfaceEvas::RemoteSurfaceEvas(int rid, const std::string& id,
                                      RemoteSurface::Type type,
                                      std::shared_ptr<EvasObject> viewerWin,
                                      bool mock)
-    : RemoteSurface(rid, id, type, util::GetWlSurface(*viewerWin.get()), mock),
+    : RemoteSurface(rid, id, type, util::GetWlSurface(*viewerWin.get(), mock), mock),
       impl_(new Impl(this, viewerWin, mock)) {
 }
 
@@ -60,7 +60,8 @@ RemoteSurfaceEvas& RemoteSurfaceEvas::operator=(
 
 RemoteSurfaceEvas::Impl::Impl(RemoteSurfaceEvas* parent,
     std::shared_ptr<EvasObject> viewerWin, bool mock)
-    : viewer_win_(viewerWin), parent_(parent), mock_(mock), win_ctx_(new WindowContext()) {
+    : viewer_win_(viewerWin), parent_(parent), mock_(mock),
+    win_ctx_(mock ? nullptr : new WindowContext()) {
 }
 
 void RemoteSurfaceEvas::Impl::OnMouseIn(const EvasObject& obj,
index 9639582..5ed7355 100644 (file)
@@ -35,11 +35,15 @@ namespace screen_connector {
 RemoteSurfaceWatcher::Impl::Impl(RemoteSurfaceWatcher* parent,
                                  RemoteSurface::Type type,
                                  std::shared_ptr<EvasObject> viewer_win,
-                                 bool focused_only)
+                                 bool focused_only, bool mock)
     : viewer_win_(viewer_win),
-      aul_handle_(new AulHandle(this, (aul_screen_type_e)type)),
+      aul_handle_(mock ? new test::AulHandleMock(this,
+          (aul_screen_type_e)type) : new AulHandle(this,
+          (aul_screen_type_e)type)),
       parent_(parent),
       focused_only_(focused_only), block_update_(false) {
+  if (mock)
+    return;
   if (focused_only_) {
     int ret = aul_screen_connector_trigger_focused_force();
     if (ret < 0) {
@@ -114,8 +118,8 @@ RemoteSurfaceWatcher::RemoteSurfaceWatcher(RemoteSurface::Type type,
 }
 
 RemoteSurfaceWatcher::RemoteSurfaceWatcher(RemoteSurface::Type type,
-    std::shared_ptr<EvasObject> viewerWin, bool watchFocusedOnly)
-    : impl_(new Impl(this, type, viewerWin, watchFocusedOnly)) {
+    std::shared_ptr<EvasObject> viewerWin, bool watchFocusedOnly, bool mock)
+    : impl_(new Impl(this, type, viewerWin, watchFocusedOnly, mock)) {
 }
 
 RemoteSurfaceWatcher::~RemoteSurfaceWatcher() = default;
index 037c734..cf494db 100644 (file)
@@ -33,7 +33,7 @@ class EXPORT_API RemoteSurfaceWatcher : public IWatcherEvent {
                        std::shared_ptr<EvasObject> viewerWin);
   RemoteSurfaceWatcher(RemoteSurface::Type type,
                        std::shared_ptr<EvasObject> viewerWin,
-                       bool watchFocusedOnly);
+                       bool watchFocusedOnly, bool mock = false);
   RemoteSurfaceWatcher(RemoteSurfaceWatcher&&) noexcept;
   RemoteSurfaceWatcher& operator=(RemoteSurfaceWatcher&&) noexcept;
   virtual ~RemoteSurfaceWatcher();
index 24ac69c..f271f5a 100644 (file)
@@ -28,6 +28,7 @@
 #include "screen_connector_remote_surface_evas/remote_surface_mixed_internal.h"
 #include "screen_connector_remote_surface_evas/watcher_image_internal.h"
 #include "screen_connector_remote_surface/aul_handle_internal.h"
+#include "screen_connector_remote_surface/aul_handle_mock_internal.h"
 
 namespace screen_connector {
 
@@ -46,7 +47,7 @@ class RemoteSurfaceWatcher::Impl : AulHandle::IEventListener {
  private:
   Impl(RemoteSurfaceWatcher* parent, RemoteSurface::Type type,
       std::shared_ptr<EvasObject> viewer_win,
-      bool focused_only);
+      bool focused_only, bool mock = false);
   void UpdateFocusedSurface();
 
  private:
index 393f49b..957d3bd 100644 (file)
@@ -28,7 +28,9 @@ using namespace std;
 namespace screen_connector {
 namespace util {
 
-  std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win) {
+  std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win, bool mock) {
+    if (mock)
+      return nullptr;
     struct wl_surface* surface;
     Ecore_Wl2_Window* wl_win;
     Ecore_Evas *ee = ecore_evas_ecore_evas_get(
index 85faac1..d88445f 100644 (file)
@@ -24,7 +24,8 @@
 
 namespace screen_connector {
 namespace util {
-  EXPORT_API std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win);
+  EXPORT_API std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win,
+      bool mock = false);
 }  // namespace util
 }  // namespace screen_connector