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

Unified Diff: services/ui/ws/window_server_test_impl.cc

Issue 2715533005: Make mus_demo_unittests work with multiple root windows (Closed)
Patch Set: Add a unit test for multiple windows. Created 3 years, 10 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 | « services/ui/ws/window_server_test_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_server_test_impl.cc
diff --git a/services/ui/ws/window_server_test_impl.cc b/services/ui/ws/window_server_test_impl.cc
index 20bc295c323a9dc0c30776295bcc7b0f25cad68d..007ae339a476e3d7cb16a68a529cb5b673a1fb24 100644
--- a/services/ui/ws/window_server_test_impl.cc
+++ b/services/ui/ws/window_server_test_impl.cc
@@ -20,28 +20,44 @@ WindowServerTestImpl::~WindowServerTestImpl() {}
void WindowServerTestImpl::OnWindowPaint(
const std::string& name,
- const EnsureClientHasDrawnWindowCallback& cb,
+ const EnsureClientHasDrawnRootWindowsCallback& cb,
ServerWindow* window) {
WindowTree* tree = window_server_->GetTreeWithClientName(name);
if (!tree)
return;
if (tree->HasRoot(window) && window->compositor_frame_sink_manager()) {
- cb.Run(true);
- window_server_->SetPaintCallback(base::Callback<void(ServerWindow*)>());
+ painted_window_roots_[name]++;
+ if (painted_window_roots_[name] == tree->roots().size()) {
+ painted_window_roots_.erase(name);
+ cb.Run(tree->roots().size());
+ window_server_->SetPaintCallback(base::Callback<void(ServerWindow*)>());
+ }
}
}
-void WindowServerTestImpl::EnsureClientHasDrawnWindow(
+void WindowServerTestImpl::EnsureClientHasDrawnRootWindows(
const std::string& client_name,
- const EnsureClientHasDrawnWindowCallback& callback) {
+ const EnsureClientHasDrawnRootWindowsCallback& callback) {
+ if (painted_window_roots_.find(client_name) != painted_window_roots_.end()) {
+ LOG(ERROR) << "EnsureClientHasDrawnRootWindows is already being executed "
+ "for that client name.";
+ callback.Run(0);
fwang 2017/03/01 17:24:34 I added this for completeness, although it's actua
+ return;
+ }
+
+ painted_window_roots_[client_name] = 0;
WindowTree* tree = window_server_->GetTreeWithClientName(client_name);
if (tree) {
for (const ServerWindow* window : tree->roots()) {
if (window->compositor_frame_sink_manager()) {
- callback.Run(true);
- return;
+ painted_window_roots_[client_name]++;
}
}
+ if (painted_window_roots_[client_name] == tree->roots().size()) {
+ painted_window_roots_.erase(client_name);
+ callback.Run(tree->roots().size());
+ return;
+ }
}
window_server_->SetPaintCallback(
« no previous file with comments | « services/ui/ws/window_server_test_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698