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

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

Issue 2352893002: Makes windowserver not send messages during shutdown (Closed)
Patch Set: merge 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
« no previous file with comments | « services/ui/ws/window_tree_binding.cc ('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_tree_unittest.cc
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc
index 5abfc4993587902a403572e57e6287fc2a639d39..9cddc174206cca41dc29a39838eadd0e3d95152b 100644
--- a/services/ui/ws/window_tree_unittest.cc
+++ b/services/ui/ws/window_tree_unittest.cc
@@ -43,6 +43,8 @@ namespace ws {
namespace test {
namespace {
+const UserId kTestUserId1 = "2";
+
std::string WindowIdToString(const WindowId& id) {
return base::StringPrintf("%d,%d", id.client_id, id.window_id);
}
@@ -1346,6 +1348,40 @@ TEST_F(WindowTreeTest, CaptureNotifiesWm) {
ChangesToDescription1(*embed_client->tracker()->changes())[0]);
}
+using WindowTreeShutdownTest = testing::Test;
+
+// Makes sure WindowTreeClient doesn't get any messages during shutdown.
+TEST_F(WindowTreeShutdownTest, DontSendMessagesDuringShutdown) {
+ std::unique_ptr<TestWindowTreeClient> client;
+ {
+ // Create a tree with one window.
+ WindowServerTestHelper ws_test_helper;
+ WindowServer* window_server = ws_test_helper.window_server();
+ window_server->user_id_tracker()->AddUserId(kTestUserId1);
+ const int kNumHostsToCreate = 1;
+ ws_test_helper.window_server_delegate()->set_num_displays_to_create(
+ kNumHostsToCreate);
+
+ WindowManagerWindowTreeFactorySetTestApi(
+ window_server->window_manager_window_tree_factory_set())
+ .Add(kTestUserId1);
+ window_server->user_id_tracker()->SetActiveUserId(kTestUserId1);
+ TestWindowTreeBinding* test_binding =
+ ws_test_helper.window_server_delegate()->last_binding();
+ ASSERT_TRUE(test_binding);
+ WindowTree* tree = test_binding->tree();
+ const ClientWindowId window_id = BuildClientWindowId(tree, 2);
+ ASSERT_TRUE(tree->NewWindow(window_id, ServerWindow::Properties()));
+
+ // Release the client so that it survices shutdown.
+ client = test_binding->ReleaseClient();
+ client->tracker()->changes()->clear();
+ }
+
+ // Client should not have got any messages after shutdown.
+ EXPECT_TRUE(client->tracker()->changes()->empty());
+}
+
} // namespace test
} // namespace ws
} // namespace ui
« no previous file with comments | « services/ui/ws/window_tree_binding.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698