| 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 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 const Id window_2_101 = wt_client2()->NewWindow(101); | 2139 const Id window_2_101 = wt_client2()->NewWindow(101); |
| 2140 ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101)); | 2140 ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101)); |
| 2141 const Id window_2_101_in_ws1 = BuildWindowId(client_id_2(), 1); | 2141 const Id window_2_101_in_ws1 = BuildWindowId(client_id_2(), 1); |
| 2142 wt_client1()->WaitForChangeCount(1); | 2142 wt_client1()->WaitForChangeCount(1); |
| 2143 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) + | 2143 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) + |
| 2144 " old_parent=null new_parent=" + IdToString(window_1_100), | 2144 " old_parent=null new_parent=" + IdToString(window_1_100), |
| 2145 SingleChangeToDescription(*changes1())); | 2145 SingleChangeToDescription(*changes1())); |
| 2146 changes1()->clear(); | 2146 changes1()->clear(); |
| 2147 | 2147 |
| 2148 // Submit a CompositorFrame to window_2_101 and make sure server gets it. | 2148 // Submit a CompositorFrame to window_2_101 and make sure server gets it. |
| 2149 mojom::SurfacePtr surface_ptr; | 2149 cc::mojom::MojoCompositorFrameSinkPtr surface_ptr; |
| 2150 mojom::SurfaceClientRequest client_request; | 2150 cc::mojom::MojoCompositorFrameSinkClientRequest client_request; |
| 2151 mojom::SurfaceClientPtr surface_client_ptr; | 2151 cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr; |
| 2152 client_request = mojo::GetProxy(&surface_client_ptr); | 2152 client_request = mojo::GetProxy(&surface_client_ptr); |
| 2153 wt2()->AttachSurface(window_2_101, mojom::SurfaceType::DEFAULT, | 2153 wt2()->AttachSurface(window_2_101, mojom::SurfaceType::DEFAULT, |
| 2154 mojo::GetProxy(&surface_ptr), | 2154 mojo::GetProxy(&surface_ptr), |
| 2155 std::move(surface_client_ptr)); | 2155 std::move(surface_client_ptr)); |
| 2156 cc::CompositorFrame compositor_frame; | 2156 cc::CompositorFrame compositor_frame; |
| 2157 compositor_frame.delegated_frame_data = | 2157 compositor_frame.delegated_frame_data = |
| 2158 base::MakeUnique<cc::DelegatedFrameData>(); | 2158 base::MakeUnique<cc::DelegatedFrameData>(); |
| 2159 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); | 2159 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); |
| 2160 gfx::Rect frame_rect(0, 0, 100, 100); | 2160 gfx::Rect frame_rect(0, 0, 100, 100); |
| 2161 render_pass->SetNew(cc::RenderPassId(1, 1), frame_rect, frame_rect, | 2161 render_pass->SetNew(cc::RenderPassId(1, 1), frame_rect, frame_rect, |
| 2162 gfx::Transform()); | 2162 gfx::Transform()); |
| 2163 compositor_frame.delegated_frame_data->render_pass_list.push_back( | 2163 compositor_frame.delegated_frame_data->render_pass_list.push_back( |
| 2164 std::move(render_pass)); | 2164 std::move(render_pass)); |
| 2165 surface_ptr->SubmitCompositorFrame(std::move(compositor_frame), | 2165 surface_ptr->SubmitCompositorFrame(std::move(compositor_frame)); |
| 2166 base::Closure()); | |
| 2167 // Make sure the parent connection gets the surface ID. | 2166 // Make sure the parent connection gets the surface ID. |
| 2168 wt_client1()->WaitForChangeCount(1); | 2167 wt_client1()->WaitForChangeCount(1); |
| 2169 // Verify that the submitted frame is for |window_2_101|. | 2168 // Verify that the submitted frame is for |window_2_101|. |
| 2170 EXPECT_EQ(window_2_101_in_ws1, | 2169 EXPECT_EQ(window_2_101_in_ws1, |
| 2171 changes1()->back().surface_id.frame_sink_id().client_id()); | 2170 changes1()->back().surface_id.frame_sink_id().client_id()); |
| 2172 } | 2171 } |
| 2173 | 2172 |
| 2174 // TODO(sky): need to better track changes to initial client. For example, | 2173 // TODO(sky): need to better track changes to initial client. For example, |
| 2175 // that SetBounsdWindows/AddWindow and the like don't result in messages to the | 2174 // that SetBounsdWindows/AddWindow and the like don't result in messages to the |
| 2176 // originating client. | 2175 // originating client. |
| 2177 | 2176 |
| 2178 // TODO(sky): make sure coverage of what was | 2177 // TODO(sky): make sure coverage of what was |
| 2179 // WindowManagerTest.SecondEmbedRoot_InitService and | 2178 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 2180 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 2179 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 2181 // manager | 2180 // manager |
| 2182 // tests. | 2181 // tests. |
| 2183 | 2182 |
| 2184 } // namespace test | 2183 } // namespace test |
| 2185 } // namespace ws | 2184 } // namespace ws |
| 2186 } // namespace ui | 2185 } // namespace ui |
| OLD | NEW |