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

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

Issue 2715533005: Make mus_demo_unittests work with multiple root windows (Closed)
Patch Set: Pass the count to the callback. 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 ff5e7414560478cd4f051eb3252c81aca880fa02..d777c453b5ce3b486c3845073c2095630da637bc 100644
--- a/services/ui/ws/window_server_test_impl.cc
+++ b/services/ui/ws/window_server_test_impl.cc
@@ -30,28 +30,43 @@ 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) && WindowHasValidFrame(window)) {
- 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.";
fwang 2017/02/24 08:51:15 This is maybe not a big concern for now (the funct
+ return;
+ }
+
+ painted_window_roots_[client_name] = 0;
WindowTree* tree = window_server_->GetTreeWithClientName(client_name);
if (tree) {
for (const ServerWindow* window : tree->roots()) {
if (WindowHasValidFrame(window)) {
- 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