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

Unified Diff: services/ui/public/cpp/tests/window_server_test_base.h

Issue 2301353003: Changes ownership of WindowTreeClient (Closed)
Patch Set: fix navigation Created 4 years, 3 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
Index: services/ui/public/cpp/tests/window_server_test_base.h
diff --git a/services/ui/public/cpp/tests/window_server_test_base.h b/services/ui/public/cpp/tests/window_server_test_base.h
index 50c9e0ceeea5eff250c1222ef0d63d2c50e676bb..b21a82c76da219d43348792b98a26f83debbb880 100644
--- a/services/ui/public/cpp/tests/window_server_test_base.h
+++ b/services/ui/public/cpp/tests/window_server_test_base.h
@@ -6,6 +6,7 @@
#define SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_TEST_BASE_H_
#include <memory>
+#include <set>
#include "base/macros.h"
#include "services/shell/public/cpp/interface_factory.h"
@@ -30,9 +31,9 @@ class WindowServerTestBase
WindowServerTestBase();
~WindowServerTestBase() override;
- // True if WindowTreeClientDelegate::OnDidDestroyClient() was called.
- bool window_tree_client_destroyed() const {
- return window_tree_client_destroyed_;
+ // True if WindowTreeClientDelegate::OnLostConnection() was called.
+ bool window_tree_client_lost_connection() const {
+ return window_tree_client_lost_connection_;
}
// Runs the MessageLoop until QuitRunLoop() is called, or a timeout occurs.
@@ -59,6 +60,9 @@ class WindowServerTestBase
window_manager_delegate_ = delegate;
}
+ // Cleans up internal state then deletes |client|.
+ void DeleteWindowTreeClient(ui::WindowTreeClient* client);
+
// testing::Test:
void SetUp() override;
@@ -68,7 +72,8 @@ class WindowServerTestBase
// WindowTreeClientDelegate:
void OnEmbed(Window* root) override;
- void OnDidDestroyClient(WindowTreeClient* client) override;
+ void OnLostConnection(WindowTreeClient* client) override;
+ void OnEmbedRootDestroyed(Window* root) override;
void OnPointerEventObserved(const ui::PointerEvent& event,
Window* target) override;
@@ -103,6 +108,8 @@ class WindowServerTestBase
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
// the root window).
WindowTreeClient* window_manager_;
@@ -113,7 +120,7 @@ class WindowServerTestBase
WindowManagerClient* window_manager_client_;
- bool window_tree_client_destroyed_;
+ bool window_tree_client_lost_connection_ = false;
DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase);
};
« no previous file with comments | « services/ui/public/cpp/tests/test_window_tree_client_setup.cc ('k') | services/ui/public/cpp/tests/window_server_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698