| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 
| 6 #define UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 6 #define UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 
| 7 | 7 | 
| 8 #include <wayland-server-core.h> | 8 #include <wayland-server-core.h> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 64   MOCK_METHOD4(Damage, | 64   MOCK_METHOD4(Damage, | 
| 65                void(int32_t x, int32_t y, int32_t width, int32_t height)); | 65                void(int32_t x, int32_t y, int32_t width, int32_t height)); | 
| 66   MOCK_METHOD0(Commit, void()); | 66   MOCK_METHOD0(Commit, void()); | 
| 67 | 67 | 
| 68   scoped_ptr<MockXdgSurface> xdg_surface; | 68   scoped_ptr<MockXdgSurface> xdg_surface; | 
| 69 | 69 | 
| 70  private: | 70  private: | 
| 71   DISALLOW_COPY_AND_ASSIGN(MockSurface); | 71   DISALLOW_COPY_AND_ASSIGN(MockSurface); | 
| 72 }; | 72 }; | 
| 73 | 73 | 
|  | 74 class MockPointer : public ServerObject { | 
|  | 75  public: | 
|  | 76   MockPointer(wl_resource* resource); | 
|  | 77   ~MockPointer() override; | 
|  | 78 | 
|  | 79  private: | 
|  | 80   DISALLOW_COPY_AND_ASSIGN(MockPointer); | 
|  | 81 }; | 
|  | 82 | 
| 74 struct GlobalDeleter { | 83 struct GlobalDeleter { | 
| 75   void operator()(wl_global* global); | 84   void operator()(wl_global* global); | 
| 76 }; | 85 }; | 
| 77 | 86 | 
| 78 class Global { | 87 class Global { | 
| 79  public: | 88  public: | 
| 80   Global(const wl_interface* interface, | 89   Global(const wl_interface* interface, | 
| 81          const void* implementation, | 90          const void* implementation, | 
| 82          uint32_t version); | 91          uint32_t version); | 
| 83   virtual ~Global(); | 92   virtual ~Global(); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 111   ~MockCompositor() override; | 120   ~MockCompositor() override; | 
| 112 | 121 | 
| 113   void AddSurface(scoped_ptr<MockSurface> surface); | 122   void AddSurface(scoped_ptr<MockSurface> surface); | 
| 114 | 123 | 
| 115  private: | 124  private: | 
| 116   std::vector<scoped_ptr<MockSurface>> surfaces_; | 125   std::vector<scoped_ptr<MockSurface>> surfaces_; | 
| 117 | 126 | 
| 118   DISALLOW_COPY_AND_ASSIGN(MockCompositor); | 127   DISALLOW_COPY_AND_ASSIGN(MockCompositor); | 
| 119 }; | 128 }; | 
| 120 | 129 | 
|  | 130 class MockSeat : public Global { | 
|  | 131  public: | 
|  | 132   MockSeat(); | 
|  | 133   ~MockSeat() override; | 
|  | 134 | 
|  | 135   scoped_ptr<MockPointer> pointer; | 
|  | 136 | 
|  | 137  private: | 
|  | 138   DISALLOW_COPY_AND_ASSIGN(MockSeat); | 
|  | 139 }; | 
|  | 140 | 
| 121 class MockXdgShell : public Global { | 141 class MockXdgShell : public Global { | 
| 122  public: | 142  public: | 
| 123   MockXdgShell(); | 143   MockXdgShell(); | 
| 124   ~MockXdgShell() override; | 144   ~MockXdgShell() override; | 
| 125 | 145 | 
| 126   MOCK_METHOD1(UseUnstableVersion, void(int32_t version)); | 146   MOCK_METHOD1(UseUnstableVersion, void(int32_t version)); | 
| 127   MOCK_METHOD1(Pong, void(uint32_t serial)); | 147   MOCK_METHOD1(Pong, void(uint32_t serial)); | 
| 128 | 148 | 
| 129  private: | 149  private: | 
| 130   DISALLOW_COPY_AND_ASSIGN(MockXdgShell); | 150   DISALLOW_COPY_AND_ASSIGN(MockXdgShell); | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 151 | 171 | 
| 152   // Resume the server after flushing client connections. | 172   // Resume the server after flushing client connections. | 
| 153   void Resume(); | 173   void Resume(); | 
| 154 | 174 | 
| 155   template <typename T> | 175   template <typename T> | 
| 156   T* GetObject(uint32_t id) { | 176   T* GetObject(uint32_t id) { | 
| 157     wl_resource* resource = wl_client_get_object(client_, id); | 177     wl_resource* resource = wl_client_get_object(client_, id); | 
| 158     return resource ? T::FromResource(resource) : nullptr; | 178     return resource ? T::FromResource(resource) : nullptr; | 
| 159   } | 179   } | 
| 160 | 180 | 
|  | 181   MockSeat* seat() { return &seat_; } | 
| 161   MockXdgShell* xdg_shell() { return &xdg_shell_; } | 182   MockXdgShell* xdg_shell() { return &xdg_shell_; } | 
| 162 | 183 | 
| 163  private: | 184  private: | 
| 164   void DoPause(); | 185   void DoPause(); | 
| 165 | 186 | 
| 166   scoped_ptr<base::MessagePump> CreateMessagePump(); | 187   scoped_ptr<base::MessagePump> CreateMessagePump(); | 
| 167 | 188 | 
| 168   // base::MessagePumpLibevent::Watcher | 189   // base::MessagePumpLibevent::Watcher | 
| 169   void OnFileCanReadWithoutBlocking(int fd) override; | 190   void OnFileCanReadWithoutBlocking(int fd) override; | 
| 170   void OnFileCanWriteWithoutBlocking(int fd) override; | 191   void OnFileCanWriteWithoutBlocking(int fd) override; | 
| 171 | 192 | 
| 172   scoped_ptr<wl_display, DisplayDeleter> display_; | 193   scoped_ptr<wl_display, DisplayDeleter> display_; | 
| 173   wl_client* client_ = nullptr; | 194   wl_client* client_ = nullptr; | 
| 174   wl_event_loop* event_loop_ = nullptr; | 195   wl_event_loop* event_loop_ = nullptr; | 
| 175 | 196 | 
| 176   base::WaitableEvent pause_event_; | 197   base::WaitableEvent pause_event_; | 
| 177   base::WaitableEvent resume_event_; | 198   base::WaitableEvent resume_event_; | 
| 178   bool paused_ = false; | 199   bool paused_ = false; | 
| 179 | 200 | 
| 180   MockCompositor compositor_; | 201   MockCompositor compositor_; | 
|  | 202   MockSeat seat_; | 
| 181   MockXdgShell xdg_shell_; | 203   MockXdgShell xdg_shell_; | 
| 182 | 204 | 
| 183   base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 205   base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 
| 184 | 206 | 
| 185   DISALLOW_COPY_AND_ASSIGN(FakeServer); | 207   DISALLOW_COPY_AND_ASSIGN(FakeServer); | 
| 186 }; | 208 }; | 
| 187 | 209 | 
| 188 }  // namespace wl | 210 }  // namespace wl | 
| 189 | 211 | 
| 190 #endif  // UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 212 #endif  // UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 
| OLD | NEW | 
|---|