| 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
|
|
|