Commit 919090e7 authored by kylechar's avatar kylechar Committed by Commit bot

Make WindowServerTestBase connect as WM client.

WindowServerTestBase already implements the WindowManagerDelegate
interface to be a WM client. Instead of connecting to service:ui as a WM
client, it connects using mojom::WindowTreeHost. This interface is only
used in tests and doesn't exercise the real display codepath in
service:ui.

Change WindowServerTestBase to connect WM client. The first response
that it receives will be in OnWmNewDisplay() instead of OnEmbed(), so
move call QuitRunLoop() to OnWmNewDisplay() as well.

BUG=none

Review-Url: https://codereview.chromium.org/2438193003
Cr-Commit-Position: refs/heads/master@{#427159}
parent 7265b814
......@@ -14,7 +14,6 @@
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/cpp/window_tree_client.h"
#include "services/ui/public/cpp/window_tree_host_factory.h"
namespace ui {
namespace {
......@@ -30,8 +29,7 @@ void TimeoutRunLoop(const base::Closure& timeout_task, bool* timeout) {
} // namespace
WindowServerTestBase::WindowServerTestBase()
: most_recent_client_(nullptr),
window_manager_(nullptr),
: window_manager_(nullptr),
window_manager_delegate_(nullptr),
window_manager_client_(nullptr) {}
......@@ -82,7 +80,8 @@ void WindowServerTestBase::SetUp() {
WindowServerServiceTestBase::SetUp();
std::unique_ptr<WindowTreeClient> window_manager_window_tree_client =
CreateWindowTreeHost(connector(), this, &host_, this);
base::MakeUnique<WindowTreeClient>(this, this);
window_manager_window_tree_client->ConnectAsWindowManager(connector());
window_manager_ = window_manager_window_tree_client.get();
window_tree_clients_.insert(std::move(window_manager_window_tree_client));
......@@ -97,10 +96,7 @@ bool WindowServerTestBase::OnConnect(
}
void WindowServerTestBase::OnEmbed(Window* root) {
most_recent_client_ = root->window_tree();
EXPECT_TRUE(QuitRunLoop());
ASSERT_TRUE(window_manager_client_);
window_manager_client_->AddActivationParent(root);
}
void WindowServerTestBase::OnLostConnection(WindowTreeClient* client) {
......@@ -150,6 +146,10 @@ void WindowServerTestBase::OnWmClientJankinessChanged(
void WindowServerTestBase::OnWmNewDisplay(Window* window,
const display::Display& display) {
EXPECT_TRUE(QuitRunLoop());
ASSERT_TRUE(window_manager_client_);
window_manager_client_->AddActivationParent(window);
if (window_manager_delegate_)
window_manager_delegate_->OnWmNewDisplay(window, display);
}
......
......@@ -14,7 +14,6 @@
#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 "services/ui/public/interfaces/window_tree_host.mojom.h"
namespace ui {
......@@ -51,11 +50,6 @@ class WindowServerTestBase
}
protected:
mojom::WindowTreeHost* host() { return host_.get(); }
WindowTreeClient* most_recent_client() {
return most_recent_client_;
}
void set_window_manager_delegate(WindowManagerDelegate* delegate) {
window_manager_delegate_ = delegate;
}
......@@ -103,13 +97,7 @@ class WindowServerTestBase
void Create(const service_manager::Identity& remote_identity,
mojo::InterfaceRequest<mojom::WindowTreeClient> request) override;
// Used to receive the most recent window tree client loaded by an embed
// action.
WindowTreeClient* most_recent_client_;
private:
mojom::WindowTreeHostPtr host_;
std::set<std::unique_ptr<WindowTreeClient>> window_tree_clients_;
// The window server connection held by the window manager (app running at
......
......@@ -11,7 +11,10 @@
"requires": {
"*": [ "app" ],
"service:mus_ws_unittests_app": [ "ui:window_tree_client" ],
"service:ui": [ "ui:window_tree_host_factory" ]
"service:ui": [
"ui:window_tree_host_factory",
"ui:window_manager"
]
}
}
}
......
......@@ -14,7 +14,6 @@
#include "services/ui/common/util.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"
#include "services/ui/surfaces/display_compositor.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/ids.h"
#include "services/ui/ws/platform_display.h"
......
......@@ -16,7 +16,6 @@
#include "services/ui/surfaces/display_compositor.h"
#include "services/ui/ws/accelerator.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/platform_display.h"
#include "services/ui/ws/platform_display_init_params.h"
......
......@@ -12,7 +12,6 @@
#include "base/stl_util.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/gpu_service_proxy.h"
#include "services/ui/ws/operation.h"
......
......@@ -18,7 +18,6 @@
#include "mojo/public/cpp/bindings/binding.h"
#include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"
#include "services/ui/public/interfaces/window_tree_host.mojom.h"
#include "services/ui/surfaces/display_compositor.h"
#include "services/ui/surfaces/display_compositor_client.h"
#include "services/ui/ws/display.h"
......
......@@ -18,7 +18,6 @@
#include "services/ui/public/interfaces/window_tree.mojom.h"
#include "services/ui/surfaces/display_compositor.h"
#include "services/ui/ws/default_access_policy.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/ids.h"
#include "services/ui/ws/platform_display.h"
#include "services/ui/ws/platform_display_factory.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment