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 f44679b47e7fd65bf09795653a884581752f8830..87f4bd0bab9c81bd4b3e9c4b041b66f5a63b4049 100644 |
--- a/services/ui/ws/window_tree_unittest.cc |
+++ b/services/ui/ws/window_tree_unittest.cc |
@@ -1394,6 +1394,39 @@ TEST_F(WindowTreeTest, CaptureNotifiesWm) { |
ChangesToDescription1(*embed_client->tracker()->changes())[0]); |
} |
+TEST_F(WindowTreeTest, SetModalTypeForwardedToWindowManager) { |
+ TestWindowManager wm_internal; |
+ set_window_manager_internal(wm_tree(), &wm_internal); |
+ |
+ TestWindowTreeBinding* child_binding = nullptr; |
+ WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
+ |
+ // Create a new top level window. |
+ std::unordered_map<std::string, std::vector<uint8_t>> properties; |
+ const uint32_t initial_change_id = 17; |
+ // Explicitly use an id that does not contain the client id. |
+ const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
+ static_cast<mojom::WindowTree*>(child_tree) |
+ ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
+ properties); |
+ |
+ // Create the window for |embed_window_id2_in_child|. |
+ const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
+ EXPECT_TRUE( |
+ wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
+ EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id2, true)); |
+ EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id2)); |
+ |
+ // Ack the change, which should resume the binding. |
+ static_cast<mojom::WindowManagerClient*>(wm_tree()) |
+ ->OnWmCreatedTopLevelWindow(0u, embed_window_id2.id); |
+ |
+ // Change modal type to MODAL_TYPE_SYSTEM and check that it is forwarded to |
+ // the window manager. |
+ child_tree->SetModalType(embed_window_id2_in_child, MODAL_TYPE_SYSTEM); |
+ EXPECT_TRUE(wm_internal.on_set_modal_type_called()); |
+} |
+ |
using WindowTreeShutdownTest = testing::Test; |
// Makes sure WindowTreeClient doesn't get any messages during shutdown. |