OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/ui/ws/window_tree.h" | 5 #include "services/ui/ws/window_tree.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 | 1387 |
1388 // Set capture from server and ensure embedded tree notified. | 1388 // Set capture from server and ensure embedded tree notified. |
1389 EXPECT_TRUE(owning_tree->ReleaseCapture( | 1389 EXPECT_TRUE(owning_tree->ReleaseCapture( |
1390 ClientWindowIdForWindow(owning_tree, FirstRoot(embed_tree)))); | 1390 ClientWindowIdForWindow(owning_tree, FirstRoot(embed_tree)))); |
1391 EXPECT_TRUE(wm_client()->tracker()->changes()->empty()); | 1391 EXPECT_TRUE(wm_client()->tracker()->changes()->empty()); |
1392 ASSERT_TRUE(!embed_client->tracker()->changes()->empty()); | 1392 ASSERT_TRUE(!embed_client->tracker()->changes()->empty()); |
1393 EXPECT_EQ("OnCaptureChanged new_window=null old_window=1,1", | 1393 EXPECT_EQ("OnCaptureChanged new_window=null old_window=1,1", |
1394 ChangesToDescription1(*embed_client->tracker()->changes())[0]); | 1394 ChangesToDescription1(*embed_client->tracker()->changes())[0]); |
1395 } | 1395 } |
1396 | 1396 |
| 1397 TEST_F(WindowTreeTest, SetModalTypeForwardedToWindowManager) { |
| 1398 TestWindowManager wm_internal; |
| 1399 set_window_manager_internal(wm_tree(), &wm_internal); |
| 1400 |
| 1401 TestWindowTreeBinding* child_binding = nullptr; |
| 1402 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
| 1403 |
| 1404 // Create a new top level window. |
| 1405 std::unordered_map<std::string, std::vector<uint8_t>> properties; |
| 1406 const uint32_t initial_change_id = 17; |
| 1407 // Explicitly use an id that does not contain the client id. |
| 1408 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
| 1409 static_cast<mojom::WindowTree*>(child_tree) |
| 1410 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
| 1411 properties); |
| 1412 |
| 1413 // Create the window for |embed_window_id2_in_child|. |
| 1414 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
| 1415 EXPECT_TRUE( |
| 1416 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
| 1417 EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id2, true)); |
| 1418 EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id2)); |
| 1419 |
| 1420 // Ack the change, which should resume the binding. |
| 1421 static_cast<mojom::WindowManagerClient*>(wm_tree()) |
| 1422 ->OnWmCreatedTopLevelWindow(0u, embed_window_id2.id); |
| 1423 |
| 1424 // Change modal type to MODAL_TYPE_SYSTEM and check that it is forwarded to |
| 1425 // the window manager. |
| 1426 child_tree->SetModalType(embed_window_id2_in_child, MODAL_TYPE_SYSTEM); |
| 1427 EXPECT_TRUE(wm_internal.on_set_modal_type_called()); |
| 1428 } |
| 1429 |
1397 using WindowTreeShutdownTest = testing::Test; | 1430 using WindowTreeShutdownTest = testing::Test; |
1398 | 1431 |
1399 // Makes sure WindowTreeClient doesn't get any messages during shutdown. | 1432 // Makes sure WindowTreeClient doesn't get any messages during shutdown. |
1400 TEST_F(WindowTreeShutdownTest, DontSendMessagesDuringShutdown) { | 1433 TEST_F(WindowTreeShutdownTest, DontSendMessagesDuringShutdown) { |
1401 std::unique_ptr<TestWindowTreeClient> client; | 1434 std::unique_ptr<TestWindowTreeClient> client; |
1402 { | 1435 { |
1403 // Create a tree with one window. | 1436 // Create a tree with one window. |
1404 WindowServerTestHelper ws_test_helper; | 1437 WindowServerTestHelper ws_test_helper; |
1405 WindowServer* window_server = ws_test_helper.window_server(); | 1438 WindowServer* window_server = ws_test_helper.window_server(); |
1406 TestScreenManager screen_manager; | 1439 TestScreenManager screen_manager; |
(...skipping 15 matching lines...) Expand all Loading... |
1422 client->tracker()->changes()->clear(); | 1455 client->tracker()->changes()->clear(); |
1423 } | 1456 } |
1424 | 1457 |
1425 // Client should not have got any messages after shutdown. | 1458 // Client should not have got any messages after shutdown. |
1426 EXPECT_TRUE(client->tracker()->changes()->empty()); | 1459 EXPECT_TRUE(client->tracker()->changes()->empty()); |
1427 } | 1460 } |
1428 | 1461 |
1429 } // namespace test | 1462 } // namespace test |
1430 } // namespace ws | 1463 } // namespace ws |
1431 } // namespace ui | 1464 } // namespace ui |
OLD | NEW |