Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1131)

Unified Diff: services/ui/ws/window_server_test_base.h

Issue 2559703003: Converts WindowTreeClientTest to be in terms of aura (Closed)
Patch Set: tweak Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/window_server_test_base.h
diff --git a/services/ui/public/cpp/tests/window_server_test_base.h b/services/ui/ws/window_server_test_base.h
similarity index 52%
rename from services/ui/public/cpp/tests/window_server_test_base.h
rename to services/ui/ws/window_server_test_base.h
index 6cbe7b7aa1cb6b6c8bed9bd8adc2e5d7ecfdcbf1..554ff1bed0df57557d2b703cf39c89439fb334f9 100644
--- a/services/ui/public/cpp/tests/window_server_test_base.h
+++ b/services/ui/ws/window_server_test_base.h
@@ -2,21 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_
-#define SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_
+#ifndef SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_
+#define SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_
#include <memory>
#include <set>
#include "base/macros.h"
#include "services/service_manager/public/cpp/interface_factory.h"
-#include "services/ui/public/cpp/tests/window_server_shelltest_base.h"
-#include "services/ui/public/cpp/window_manager_delegate.h"
-#include "services/ui/public/cpp/window_tree_client_delegate.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"
-#include "ui/display/test/test_screen.h"
+#include "services/ui/ws/window_server_service_test_base.h"
+#include "ui/aura/mus/property_converter.h"
+#include "ui/aura/mus/window_manager_delegate.h"
+#include "ui/aura/mus/window_tree_client_delegate.h"
+#include "ui/display/screen_base.h"
+#include "ui/wm/core/wm_state.h"
+
+namespace aura {
+class Env;
+class MusContextFactory;
+}
namespace ui {
+class GpuService;
// WindowServerTestBase is a base class for use with shell tests that use
// WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed()
@@ -24,8 +32,8 @@ namespace ui {
// established as part of SetUp().
class WindowServerTestBase
: public WindowServerServiceTestBase,
- public WindowTreeClientDelegate,
- public WindowManagerDelegate,
+ public aura::WindowTreeClientDelegate,
+ public aura::WindowManagerDelegate,
public service_manager::InterfaceFactory<mojom::WindowTreeClient> {
public:
WindowServerTestBase();
@@ -45,74 +53,94 @@ class WindowServerTestBase
// success, false if a RunLoop isn't running.
static bool QuitRunLoop() WARN_UNUSED_RESULT;
- WindowTreeClient* window_manager() { return window_manager_; }
- WindowManagerClient* window_manager_client() {
+ aura::WindowTreeClient* window_manager() { return window_manager_; }
+ aura::WindowManagerClient* window_manager_client() {
return window_manager_client_;
}
protected:
- void set_window_manager_delegate(WindowManagerDelegate* delegate) {
+ void set_window_manager_delegate(aura::WindowManagerDelegate* delegate) {
window_manager_delegate_ = delegate;
}
// Cleans up internal state then deletes |client|.
- void DeleteWindowTreeClient(ui::WindowTreeClient* client);
+ void DeleteWindowTreeClient(aura::WindowTreeClient* client);
+
+ std::unique_ptr<aura::WindowTreeClient> ReleaseMostRecentClient();
msw 2016/12/08 01:20:12 nit: comment
sky 2016/12/08 04:59:45 Done.
// testing::Test:
void SetUp() override;
+ void TearDown() override;
// WindowServerServiceTestBase:
bool OnConnect(const service_manager::Identity& remote_identity,
service_manager::InterfaceRegistry* registry) override;
// WindowTreeClientDelegate:
- void OnEmbed(Window* root) override;
- void OnLostConnection(WindowTreeClient* client) override;
- void OnEmbedRootDestroyed(Window* root) override;
+ void OnEmbed(
+ std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override;
+ void OnLostConnection(aura::WindowTreeClient* client) override;
+ void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override;
void OnPointerEventObserved(const ui::PointerEvent& event,
- Window* target) override;
+ aura::Window* target) override;
+ aura::client::CaptureClient* GetCaptureClient() override;
+ aura::PropertyConverter* GetPropertyConverter() override;
// WindowManagerDelegate:
- void SetWindowManagerClient(WindowManagerClient* client) override;
- bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override;
+ void SetWindowManagerClient(aura::WindowManagerClient* client) override;
+ bool OnWmSetBounds(aura::Window* window, gfx::Rect* bounds) override;
bool OnWmSetProperty(
- Window* window,
+ aura::Window* window,
const std::string& name,
std::unique_ptr<std::vector<uint8_t>>* new_data) override;
- Window* OnWmCreateTopLevelWindow(
+ aura::Window* OnWmCreateTopLevelWindow(
+ ui::mojom::WindowType window_type,
std::map<std::string, std::vector<uint8_t>>* properties) override;
- void OnWmClientJankinessChanged(const std::set<Window*>& client_windows,
+ void OnWmClientJankinessChanged(const std::set<aura::Window*>& client_windows,
bool not_responding) override;
- void OnWmNewDisplay(Window* window, const display::Display& display) override;
- void OnWmDisplayRemoved(Window* window) override;
+ void OnWmWillCreateDisplay(const display::Display& display) override;
+ void OnWmNewDisplay(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
+ const display::Display& display) override;
+ void OnWmDisplayRemoved(aura::WindowTreeHostMus* window_tree_host) override;
void OnWmDisplayModified(const display::Display& display) override;
- void OnWmPerformMoveLoop(Window* window,
+ mojom::EventResult OnAccelerator(uint32_t accelerator_id,
+ const ui::Event& event) override;
+ void OnWmPerformMoveLoop(aura::Window* window,
mojom::MoveLoopSource source,
const gfx::Point& cursor_location,
const base::Callback<void(bool)>& on_done) override;
- void OnWmCancelMoveLoop(Window* window) override;
- mojom::EventResult OnAccelerator(uint32_t accelerator_id,
- const ui::Event& event) override;
+ void OnWmCancelMoveLoop(aura::Window* window) override;
+ void OnWmSetClientArea(
+ aura::Window* window,
+ const gfx::Insets& insets,
+ const std::vector<gfx::Rect>& additional_client_areas) override;
// InterfaceFactory<WindowTreeClient>:
void Create(const service_manager::Identity& remote_identity,
mojo::InterfaceRequest<mojom::WindowTreeClient> request) override;
private:
- std::set<std::unique_ptr<WindowTreeClient>> window_tree_clients_;
+ std::unique_ptr<aura::Env> env_;
+ ::wm::WMState wm_state_;
+ display::ScreenBase screen_;
+ aura::PropertyConverter property_converter_;
+
+ std::unique_ptr<GpuService> gpu_service_;
+ std::unique_ptr<aura::MusContextFactory> compositor_context_factory_;
+
+ std::vector<std::unique_ptr<aura::WindowTreeClient>> window_tree_clients_;
+
+ std::vector<std::unique_ptr<aura::WindowTreeHostMus>> window_tree_hosts_;
// The window server connection held by the window manager (app running at
// the root window).
- WindowTreeClient* window_manager_;
+ aura::WindowTreeClient* window_manager_ = nullptr;
// A test can override the WM-related behaviour by installing its own
// WindowManagerDelegate during the test.
- WindowManagerDelegate* window_manager_delegate_;
-
- WindowManagerClient* window_manager_client_;
+ aura::WindowManagerDelegate* window_manager_delegate_ = nullptr;
- // Dummy screen required to be the screen instance.
- display::test::TestScreen test_screen_;
+ aura::WindowManagerClient* window_manager_client_ = nullptr;
bool window_tree_client_lost_connection_ = false;
@@ -121,4 +149,4 @@ class WindowServerTestBase
} // namespace ui
-#endif // SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_
+#endif // SERVICES_UI_WS_WINDOW_SERVER_TEST_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698