| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 gfx::Transform()); | 2163 gfx::Transform()); |
| 2164 compositor_frame.render_pass_list.push_back(std::move(render_pass)); | 2164 compositor_frame.render_pass_list.push_back(std::move(render_pass)); |
| 2165 surface_ptr->SubmitCompositorFrame(std::move(compositor_frame)); | 2165 surface_ptr->SubmitCompositorFrame(std::move(compositor_frame)); |
| 2166 // Make sure the parent connection gets the surface ID. | 2166 // Make sure the parent connection gets the surface ID. |
| 2167 wt_client1()->WaitForChangeCount(1); | 2167 wt_client1()->WaitForChangeCount(1); |
| 2168 // Verify that the submitted frame is for |window_2_101|. | 2168 // Verify that the submitted frame is for |window_2_101|. |
| 2169 EXPECT_EQ(window_2_101_in_ws1, | 2169 EXPECT_EQ(window_2_101_in_ws1, |
| 2170 changes1()->back().surface_id.frame_sink_id().client_id()); | 2170 changes1()->back().surface_id.frame_sink_id().client_id()); |
| 2171 } | 2171 } |
| 2172 | 2172 |
| 2173 // Verifies when an unknown window with a known child is added to a hierarchy |
| 2174 // the known child is identified in the WindowData. |
| 2175 TEST_F(WindowTreeClientTest, AddUnknownWindowKnownParent) { |
| 2176 const Id window_1_100 = wt_client1()->NewWindow(100); |
| 2177 ASSERT_TRUE(window_1_100); |
| 2178 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100)); |
| 2179 |
| 2180 // Establish the second client at 1,100. |
| 2181 ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_100)); |
| 2182 const Id window_2_1 = wt_client2()->NewWindow(1000); |
| 2183 const Id window_2_2 = wt_client2()->NewWindow(2000); |
| 2184 // Add 2_1 to the root, remove 2_1, add 2_1 to 2_2 and then 2_2 to the parent. |
| 2185 ASSERT_TRUE( |
| 2186 wt_client2()->AddWindow(wt_client2()->root_window_id(), window_2_1)); |
| 2187 ASSERT_TRUE(wt_client2()->RemoveWindowFromParent(window_2_1)); |
| 2188 ASSERT_TRUE(wt_client2()->AddWindow(window_2_2, window_2_1)); |
| 2189 wt_client1()->WaitForChangeCount(2); |
| 2190 changes1()->clear(); |
| 2191 ASSERT_TRUE( |
| 2192 wt_client2()->AddWindow(wt_client2()->root_window_id(), window_2_2)); |
| 2193 wt_client1()->WaitForChangeCount(1); |
| 2194 const Id window_2_1_in_wm = BuildWindowId(client_id_2(), 1); |
| 2195 const Id window_2_2_in_wm = BuildWindowId(client_id_2(), 2); |
| 2196 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_2_in_wm) + |
| 2197 " old_parent=null new_parent=" + IdToString(window_1_100), |
| 2198 SingleChangeToDescription(*changes1())); |
| 2199 EXPECT_EQ("[window=" + IdToString(window_2_2_in_wm) + " parent=" + |
| 2200 IdToString(window_1_100) + "],[window=" + |
| 2201 IdToString(window_2_1_in_wm) + " parent=" + |
| 2202 IdToString(window_2_2_in_wm) + "]", |
| 2203 ChangeWindowDescription(*changes1())); |
| 2204 } |
| 2205 |
| 2173 // TODO(sky): need to better track changes to initial client. For example, | 2206 // TODO(sky): need to better track changes to initial client. For example, |
| 2174 // that SetBounsdWindows/AddWindow and the like don't result in messages to the | 2207 // that SetBounsdWindows/AddWindow and the like don't result in messages to the |
| 2175 // originating client. | 2208 // originating client. |
| 2176 | 2209 |
| 2177 // TODO(sky): make sure coverage of what was | 2210 // TODO(sky): make sure coverage of what was |
| 2178 // WindowManagerTest.SecondEmbedRoot_InitService and | 2211 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 2179 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 2212 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 2180 // manager | 2213 // manager |
| 2181 // tests. | 2214 // tests. |
| 2182 | 2215 |
| 2183 } // namespace test | 2216 } // namespace test |
| 2184 } // namespace ws | 2217 } // namespace ws |
| 2185 } // namespace ui | 2218 } // namespace ui |
| OLD | NEW |