| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 TEST_F(WindowTreeTest, NewTopLevelWindow) { | 624 TEST_F(WindowTreeTest, NewTopLevelWindow) { |
| 625 TestWindowManager wm_internal; | 625 TestWindowManager wm_internal; |
| 626 set_window_manager_internal(wm_tree(), &wm_internal); | 626 set_window_manager_internal(wm_tree(), &wm_internal); |
| 627 | 627 |
| 628 TestWindowTreeBinding* child_binding; | 628 TestWindowTreeBinding* child_binding; |
| 629 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); | 629 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
| 630 child_binding->client()->tracker()->changes()->clear(); | 630 child_binding->client()->tracker()->changes()->clear(); |
| 631 child_binding->client()->set_record_on_change_completed(true); | 631 child_binding->client()->set_record_on_change_completed(true); |
| 632 | 632 |
| 633 // Create a new top level window. | 633 // Create a new top level window. |
| 634 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 634 std::unordered_map<std::string, std::vector<uint8_t>> properties; |
| 635 const uint32_t initial_change_id = 17; | 635 const uint32_t initial_change_id = 17; |
| 636 // Explicitly use an id that does not contain the client id. | 636 // Explicitly use an id that does not contain the client id. |
| 637 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); | 637 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
| 638 static_cast<mojom::WindowTree*>(child_tree) | 638 static_cast<mojom::WindowTree*>(child_tree) |
| 639 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, | 639 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
| 640 std::move(properties)); | 640 properties); |
| 641 | 641 |
| 642 // The binding should be paused until the wm acks the change. | 642 // The binding should be paused until the wm acks the change. |
| 643 uint32_t wm_change_id = 0u; | 643 uint32_t wm_change_id = 0u; |
| 644 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); | 644 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); |
| 645 EXPECT_TRUE(child_binding->is_paused()); | 645 EXPECT_TRUE(child_binding->is_paused()); |
| 646 | 646 |
| 647 // Create the window for |embed_window_id2_in_child|. | 647 // Create the window for |embed_window_id2_in_child|. |
| 648 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); | 648 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
| 649 EXPECT_TRUE( | 649 EXPECT_TRUE( |
| 650 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); | 650 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 TEST_F(WindowTreeTest, ValidMoveLoopWithWM) { | 1073 TEST_F(WindowTreeTest, ValidMoveLoopWithWM) { |
| 1074 TestWindowManager wm_internal; | 1074 TestWindowManager wm_internal; |
| 1075 set_window_manager_internal(wm_tree(), &wm_internal); | 1075 set_window_manager_internal(wm_tree(), &wm_internal); |
| 1076 | 1076 |
| 1077 TestWindowTreeBinding* child_binding; | 1077 TestWindowTreeBinding* child_binding; |
| 1078 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); | 1078 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
| 1079 child_binding->client()->tracker()->changes()->clear(); | 1079 child_binding->client()->tracker()->changes()->clear(); |
| 1080 child_binding->client()->set_record_on_change_completed(true); | 1080 child_binding->client()->set_record_on_change_completed(true); |
| 1081 | 1081 |
| 1082 // Create a new top level window. | 1082 // Create a new top level window. |
| 1083 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 1083 std::unordered_map<std::string, std::vector<uint8_t>> properties; |
| 1084 const uint32_t initial_change_id = 17; | 1084 const uint32_t initial_change_id = 17; |
| 1085 // Explicitly use an id that does not contain the client id. | 1085 // Explicitly use an id that does not contain the client id. |
| 1086 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); | 1086 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
| 1087 static_cast<mojom::WindowTree*>(child_tree) | 1087 static_cast<mojom::WindowTree*>(child_tree) |
| 1088 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, | 1088 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
| 1089 std::move(properties)); | 1089 properties); |
| 1090 | 1090 |
| 1091 // The binding should be paused until the wm acks the change. | 1091 // The binding should be paused until the wm acks the change. |
| 1092 uint32_t wm_change_id = 0u; | 1092 uint32_t wm_change_id = 0u; |
| 1093 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); | 1093 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); |
| 1094 EXPECT_TRUE(child_binding->is_paused()); | 1094 EXPECT_TRUE(child_binding->is_paused()); |
| 1095 | 1095 |
| 1096 // Create the window for |embed_window_id2_in_child|. | 1096 // Create the window for |embed_window_id2_in_child|. |
| 1097 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); | 1097 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
| 1098 EXPECT_TRUE( | 1098 EXPECT_TRUE( |
| 1099 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); | 1099 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1118 TEST_F(WindowTreeTest, MoveLoopAckOKByWM) { | 1118 TEST_F(WindowTreeTest, MoveLoopAckOKByWM) { |
| 1119 TestMoveLoopWindowManager wm_internal(wm_tree()); | 1119 TestMoveLoopWindowManager wm_internal(wm_tree()); |
| 1120 set_window_manager_internal(wm_tree(), &wm_internal); | 1120 set_window_manager_internal(wm_tree(), &wm_internal); |
| 1121 | 1121 |
| 1122 TestWindowTreeBinding* child_binding; | 1122 TestWindowTreeBinding* child_binding; |
| 1123 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); | 1123 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
| 1124 child_binding->client()->tracker()->changes()->clear(); | 1124 child_binding->client()->tracker()->changes()->clear(); |
| 1125 child_binding->client()->set_record_on_change_completed(true); | 1125 child_binding->client()->set_record_on_change_completed(true); |
| 1126 | 1126 |
| 1127 // Create a new top level window. | 1127 // Create a new top level window. |
| 1128 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 1128 std::unordered_map<std::string, std::vector<uint8_t>> properties; |
| 1129 const uint32_t initial_change_id = 17; | 1129 const uint32_t initial_change_id = 17; |
| 1130 // Explicitly use an id that does not contain the client id. | 1130 // Explicitly use an id that does not contain the client id. |
| 1131 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); | 1131 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
| 1132 static_cast<mojom::WindowTree*>(child_tree) | 1132 static_cast<mojom::WindowTree*>(child_tree) |
| 1133 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, | 1133 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
| 1134 std::move(properties)); | 1134 properties); |
| 1135 | 1135 |
| 1136 // The binding should be paused until the wm acks the change. | 1136 // The binding should be paused until the wm acks the change. |
| 1137 uint32_t wm_change_id = 0u; | 1137 uint32_t wm_change_id = 0u; |
| 1138 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); | 1138 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); |
| 1139 EXPECT_TRUE(child_binding->is_paused()); | 1139 EXPECT_TRUE(child_binding->is_paused()); |
| 1140 | 1140 |
| 1141 // Create the window for |embed_window_id2_in_child|. | 1141 // Create the window for |embed_window_id2_in_child|. |
| 1142 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); | 1142 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
| 1143 EXPECT_TRUE( | 1143 EXPECT_TRUE( |
| 1144 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); | 1144 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1173 TEST_F(WindowTreeTest, WindowManagerCantMoveLoop) { | 1173 TEST_F(WindowTreeTest, WindowManagerCantMoveLoop) { |
| 1174 TestWindowManager wm_internal; | 1174 TestWindowManager wm_internal; |
| 1175 set_window_manager_internal(wm_tree(), &wm_internal); | 1175 set_window_manager_internal(wm_tree(), &wm_internal); |
| 1176 | 1176 |
| 1177 TestWindowTreeBinding* child_binding; | 1177 TestWindowTreeBinding* child_binding; |
| 1178 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); | 1178 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
| 1179 child_binding->client()->tracker()->changes()->clear(); | 1179 child_binding->client()->tracker()->changes()->clear(); |
| 1180 child_binding->client()->set_record_on_change_completed(true); | 1180 child_binding->client()->set_record_on_change_completed(true); |
| 1181 | 1181 |
| 1182 // Create a new top level window. | 1182 // Create a new top level window. |
| 1183 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 1183 std::unordered_map<std::string, std::vector<uint8_t>> properties; |
| 1184 const uint32_t initial_change_id = 17; | 1184 const uint32_t initial_change_id = 17; |
| 1185 // Explicitly use an id that does not contain the client id. | 1185 // Explicitly use an id that does not contain the client id. |
| 1186 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); | 1186 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
| 1187 static_cast<mojom::WindowTree*>(child_tree) | 1187 static_cast<mojom::WindowTree*>(child_tree) |
| 1188 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, | 1188 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
| 1189 std::move(properties)); | 1189 properties); |
| 1190 | 1190 |
| 1191 // The binding should be paused until the wm acks the change. | 1191 // The binding should be paused until the wm acks the change. |
| 1192 uint32_t wm_change_id = 0u; | 1192 uint32_t wm_change_id = 0u; |
| 1193 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); | 1193 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); |
| 1194 EXPECT_TRUE(child_binding->is_paused()); | 1194 EXPECT_TRUE(child_binding->is_paused()); |
| 1195 | 1195 |
| 1196 // Create the window for |embed_window_id2_in_child|. | 1196 // Create the window for |embed_window_id2_in_child|. |
| 1197 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); | 1197 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
| 1198 EXPECT_TRUE( | 1198 EXPECT_TRUE( |
| 1199 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); | 1199 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1218 TEST_F(WindowTreeTest, RevertWindowBoundsOnMoveLoopFailure) { | 1218 TEST_F(WindowTreeTest, RevertWindowBoundsOnMoveLoopFailure) { |
| 1219 TestWindowManager wm_internal; | 1219 TestWindowManager wm_internal; |
| 1220 set_window_manager_internal(wm_tree(), &wm_internal); | 1220 set_window_manager_internal(wm_tree(), &wm_internal); |
| 1221 | 1221 |
| 1222 TestWindowTreeBinding* child_binding; | 1222 TestWindowTreeBinding* child_binding; |
| 1223 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); | 1223 WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding); |
| 1224 child_binding->client()->tracker()->changes()->clear(); | 1224 child_binding->client()->tracker()->changes()->clear(); |
| 1225 child_binding->client()->set_record_on_change_completed(true); | 1225 child_binding->client()->set_record_on_change_completed(true); |
| 1226 | 1226 |
| 1227 // Create a new top level window. | 1227 // Create a new top level window. |
| 1228 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 1228 std::unordered_map<std::string, std::vector<uint8_t>> properties; |
| 1229 const uint32_t initial_change_id = 17; | 1229 const uint32_t initial_change_id = 17; |
| 1230 // Explicitly use an id that does not contain the client id. | 1230 // Explicitly use an id that does not contain the client id. |
| 1231 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); | 1231 const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); |
| 1232 static_cast<mojom::WindowTree*>(child_tree) | 1232 static_cast<mojom::WindowTree*>(child_tree) |
| 1233 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, | 1233 ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, |
| 1234 std::move(properties)); | 1234 properties); |
| 1235 | 1235 |
| 1236 // The binding should be paused until the wm acks the change. | 1236 // The binding should be paused until the wm acks the change. |
| 1237 uint32_t wm_change_id = 0u; | 1237 uint32_t wm_change_id = 0u; |
| 1238 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); | 1238 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); |
| 1239 EXPECT_TRUE(child_binding->is_paused()); | 1239 EXPECT_TRUE(child_binding->is_paused()); |
| 1240 | 1240 |
| 1241 // Create the window for |embed_window_id2_in_child|. | 1241 // Create the window for |embed_window_id2_in_child|. |
| 1242 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); | 1242 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); |
| 1243 EXPECT_TRUE( | 1243 EXPECT_TRUE( |
| 1244 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); | 1244 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 client->tracker()->changes()->clear(); | 1373 client->tracker()->changes()->clear(); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 // Client should not have got any messages after shutdown. | 1376 // Client should not have got any messages after shutdown. |
| 1377 EXPECT_TRUE(client->tracker()->changes()->empty()); | 1377 EXPECT_TRUE(client->tracker()->changes()->empty()); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 } // namespace test | 1380 } // namespace test |
| 1381 } // namespace ws | 1381 } // namespace ws |
| 1382 } // namespace ui | 1382 } // namespace ui |
| OLD | NEW |