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

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

Issue 2301353003: Changes ownership of WindowTreeClient (Closed)
Patch Set: 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..c796decef1d8cc1b2cb9fa09fa2c6089ea762c1d 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,10 @@ class WindowServerTestBase
window_manager_delegate_ = delegate;
}
+ // Deletes a WindowTreeClient. This cleans up internal state and then deletes
+ // its.
sadrul 2016/09/02 17:04:15 incomplete?
sky 2016/09/06 17:15:42 Done.
+ void DeleteWindowTreeClient(ui::WindowTreeClient* client);
+
// testing::Test:
void SetUp() override;
@@ -68,7 +73,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 +109,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 +121,7 @@ class WindowServerTestBase
WindowManagerClient* window_manager_client_;
- bool window_tree_client_destroyed_;
+ bool window_tree_client_lost_connection_ = false;
DISALLOW_COPY_AND_ASSIGN(WindowServerTestBase);
};

Powered by Google App Engine
This is Rietveld 408576698