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

Unified Diff: mash/wm/window_manager_unittest.cc

Issue 2018823002: Eliminate WindowTreeConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@connection
Patch Set: . Created 4 years, 7 months 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
« no previous file with comments | « mash/wm/window_manager_application.cc ('k') | services/navigation/view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/wm/window_manager_unittest.cc
diff --git a/mash/wm/window_manager_unittest.cc b/mash/wm/window_manager_unittest.cc
index 5a14ecc3c76c9349845c8412ff7e56020fa15650..e1e90e30c6c6da58c110063d4511ed68098454ff 100644
--- a/mash/wm/window_manager_unittest.cc
+++ b/mash/wm/window_manager_unittest.cc
@@ -11,8 +11,8 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_tree_connection.h"
-#include "components/mus/public/cpp/window_tree_delegate.h"
+#include "components/mus/public/cpp/window_tree_client.h"
+#include "components/mus/public/cpp/window_tree_client_delegate.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
#include "mash/wm/public/interfaces/user_window_controller.mojom.h"
#include "services/shell/public/cpp/shell_test.h"
@@ -20,18 +20,18 @@
namespace mash {
namespace wm {
-class WindowTreeDelegateImpl : public mus::WindowTreeDelegate {
+class WindowTreeClientDelegate : public mus::WindowTreeClientDelegate {
public:
- WindowTreeDelegateImpl() {}
- ~WindowTreeDelegateImpl() override {}
+ WindowTreeClientDelegate() {}
+ ~WindowTreeClientDelegate() override {}
private:
- // mus::WindowTreeDelegate:
+ // mus::WindowTreeClientDelegate:
void OnEmbed(mus::Window* root) override {}
- void OnConnectionLost(mus::WindowTreeConnection* connection) override {}
+ void OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) override {}
void OnEventObserved(const ui::Event& event, mus::Window* target) override {}
- DISALLOW_COPY_AND_ASSIGN(WindowTreeDelegateImpl);
+ DISALLOW_COPY_AND_ASSIGN(WindowTreeClientDelegate);
};
class WindowManagerTest : public shell::test::ShellTest {
@@ -111,31 +111,32 @@ class TestUserWindowObserver : public mojom::UserWindowObserver {
};
TEST_F(WindowManagerTest, OpenWindow) {
- WindowTreeDelegateImpl window_tree_delegate;
+ WindowTreeClientDelegate window_tree_delegate;
// Bring up the the desktop_wm.
connector()->Connect("mojo:desktop_wm");
// Connect to mus and create a new top level window. The request goes to
// the |desktop_wm|, but is async.
- std::unique_ptr<mus::WindowTreeConnection> connection(
- mus::WindowTreeConnection::Create(&window_tree_delegate, connector()));
- mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr);
+ std::unique_ptr<mus::WindowTreeClient> client(
+ new mus::WindowTreeClient(&window_tree_delegate, nullptr, nullptr));
+ client->ConnectViaWindowTreeFactory(connector());
+ mus::Window* top_level_window = client->NewTopLevelWindow(nullptr);
ASSERT_TRUE(top_level_window);
- mus::Window* child_window = connection->NewWindow();
+ mus::Window* child_window = client->NewWindow();
ASSERT_TRUE(child_window);
top_level_window->AddChild(child_window);
- // Create another WindowTreeConnection by way of embedding in
+ // Create another WindowTreeClient by way of embedding in
// |child_window|. This blocks until it succeeds.
mus::mojom::WindowTreeClientPtr tree_client;
auto tree_client_request = GetProxy(&tree_client);
child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed));
- std::unique_ptr<mus::WindowTreeConnection> child_connection(
- mus::WindowTreeConnection::Create(
- &window_tree_delegate, std::move(tree_client_request),
- mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED));
- ASSERT_TRUE(!child_connection->GetRoots().empty());
+ std::unique_ptr<mus::WindowTreeClient> child_client(
+ new mus::WindowTreeClient(&window_tree_delegate, nullptr,
+ std::move(tree_client_request)));
+ child_client->WaitForEmbed();
+ ASSERT_TRUE(!child_client->GetRoots().empty());
}
TEST_F(WindowManagerTest, OpenWindowAndClose) {
@@ -145,14 +146,15 @@ TEST_F(WindowManagerTest, OpenWindowAndClose) {
TestUserWindowObserver observer(connector());
// Connect to mus and create a new top level window.
- WindowTreeDelegateImpl window_tree_delegate;
- std::unique_ptr<mus::WindowTreeConnection> connection(
- mus::WindowTreeConnection::Create(&window_tree_delegate, connector()));
- mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr);
+ WindowTreeClientDelegate window_tree_delegate;
+ std::unique_ptr<mus::WindowTreeClient> client(
+ new mus::WindowTreeClient(&window_tree_delegate, nullptr, nullptr));
+ client->ConnectViaWindowTreeFactory(connector());
+ mus::Window* top_level_window = client->NewTopLevelWindow(nullptr);
ASSERT_TRUE(top_level_window);
observer.WaitUntilWindowCountReaches(1u);
- connection.reset();
+ client.reset();
observer.WaitUntilWindowCountReaches(0u);
}
« no previous file with comments | « mash/wm/window_manager_application.cc ('k') | services/navigation/view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698