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