Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: services/ui/ws/window_tree_client_unittest.cc

Issue 2934523002: Revert of Implement aura::WindowPortMus::CreateCompositorFrameSink() (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/ws/window_tree.cc ('k') | ui/aura/local/window_port_local.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 EXPECT_TRUE(changes1()->empty()); 2180 EXPECT_TRUE(changes1()->empty());
2181 } 2181 }
2182 2182
2183 TEST_F(WindowTreeClientTest, SurfaceIdPropagation) { 2183 TEST_F(WindowTreeClientTest, SurfaceIdPropagation) {
2184 const Id window_1_100 = wt_client1()->NewWindow(100); 2184 const Id window_1_100 = wt_client1()->NewWindow(100);
2185 ASSERT_TRUE(window_1_100); 2185 ASSERT_TRUE(window_1_100);
2186 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100)); 2186 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100));
2187 2187
2188 // Establish the second client at 1,100. 2188 // Establish the second client at 1,100.
2189 ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_100)); 2189 ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_100));
2190 changes2()->clear();
2191 2190
2192 // 1,100 is the id in the wt_client1's id space. The new client should see 2191 // 1,100 is the id in the wt_client1's id space. The new client should see
2193 // 2,1 (the server id). 2192 // 2,1 (the server id).
2194 const Id window_1_100_in_ws2 = BuildWindowId(client_id_1(), 1); 2193 const Id window_1_100_in_ws2 = BuildWindowId(client_id_1(), 1);
2195 EXPECT_EQ(window_1_100_in_ws2, wt_client2()->root_window_id()); 2194 EXPECT_EQ(window_1_100_in_ws2, wt_client2()->root_window_id());
2196 2195
2197 // Submit a CompositorFrame to window_1_100_in_ws2 (the embedded window in
2198 // wt2) and make sure the server gets it.
2199 {
2200 cc::mojom::MojoCompositorFrameSinkPtr surface_ptr;
2201 cc::mojom::MojoCompositorFrameSinkClientRequest client_request;
2202 cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr;
2203 client_request = mojo::MakeRequest(&surface_client_ptr);
2204 wt2()->AttachCompositorFrameSink(window_1_100_in_ws2,
2205 mojo::MakeRequest(&surface_ptr),
2206 std::move(surface_client_ptr));
2207 cc::CompositorFrame compositor_frame;
2208 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
2209 gfx::Rect frame_rect(0, 0, 100, 100);
2210 render_pass->SetNew(1, frame_rect, frame_rect, gfx::Transform());
2211 compositor_frame.render_pass_list.push_back(std::move(render_pass));
2212 compositor_frame.metadata.device_scale_factor = 1.f;
2213 compositor_frame.metadata.begin_frame_ack =
2214 cc::BeginFrameAck(0, 1, 1, true);
2215 cc::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create());
2216 surface_ptr->SubmitCompositorFrame(local_surface_id,
2217 std::move(compositor_frame));
2218 }
2219 // Make sure the parent connection gets the surface ID.
2220 wt_client1()->WaitForChangeCount(1);
2221 // Verify that the submitted frame is for |window_2_101|.
2222 EXPECT_EQ(window_1_100_in_ws2,
2223 changes1()->back().surface_id.frame_sink_id().client_id());
2224 changes1()->clear();
2225
2226 // The first window created in the second client gets a server id of 2,1 2196 // The first window created in the second client gets a server id of 2,1
2227 // regardless of the id the client uses. 2197 // regardless of the id the client uses.
2228 const Id window_2_101 = wt_client2()->NewWindow(101); 2198 const Id window_2_101 = wt_client2()->NewWindow(101);
2229 ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101)); 2199 ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101));
2230 const Id window_2_101_in_ws2 = BuildWindowId(client_id_2(), 1); 2200 const Id window_2_101_in_ws1 = BuildWindowId(client_id_2(), 1);
2231 wt_client1()->WaitForChangeCount(1); 2201 wt_client1()->WaitForChangeCount(1);
2232 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws2) + 2202 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) +
2233 " old_parent=null new_parent=" + IdToString(window_1_100), 2203 " old_parent=null new_parent=" + IdToString(window_1_100),
2234 SingleChangeToDescription(*changes1())); 2204 SingleChangeToDescription(*changes1()));
2235 // Submit a CompositorFrame to window_2_101_in_ws2 (a regular window in 2205 changes1()->clear();
2236 // wt2) and make sure client gets it. 2206
2237 { 2207 // Submit a CompositorFrame to window_2_101 and make sure server gets it.
2238 cc::mojom::MojoCompositorFrameSinkPtr surface_ptr; 2208 cc::mojom::MojoCompositorFrameSinkPtr surface_ptr;
2239 cc::mojom::MojoCompositorFrameSinkClientRequest client_request; 2209 cc::mojom::MojoCompositorFrameSinkClientRequest client_request;
2240 cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr; 2210 cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr;
2241 client_request = mojo::MakeRequest(&surface_client_ptr); 2211 client_request = mojo::MakeRequest(&surface_client_ptr);
2242 wt2()->AttachCompositorFrameSink(window_2_101, 2212 wt2()->AttachCompositorFrameSink(window_2_101,
2243 mojo::MakeRequest(&surface_ptr), 2213 mojo::MakeRequest(&surface_ptr),
2244 std::move(surface_client_ptr)); 2214 std::move(surface_client_ptr));
2245 cc::CompositorFrame compositor_frame; 2215 cc::CompositorFrame compositor_frame;
2246 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); 2216 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
2247 gfx::Rect frame_rect(0, 0, 100, 100); 2217 gfx::Rect frame_rect(0, 0, 100, 100);
2248 render_pass->SetNew(1, frame_rect, frame_rect, gfx::Transform()); 2218 render_pass->SetNew(1, frame_rect, frame_rect, gfx::Transform());
2249 compositor_frame.render_pass_list.push_back(std::move(render_pass)); 2219 compositor_frame.render_pass_list.push_back(std::move(render_pass));
2250 compositor_frame.metadata.device_scale_factor = 1.f; 2220 compositor_frame.metadata.device_scale_factor = 1.f;
2251 compositor_frame.metadata.begin_frame_ack = 2221 compositor_frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true);
2252 cc::BeginFrameAck(0, 1, 1, true); 2222 cc::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create());
2253 cc::LocalSurfaceId local_surface_id(2, base::UnguessableToken::Create()); 2223 surface_ptr->SubmitCompositorFrame(local_surface_id,
2254 surface_ptr->SubmitCompositorFrame(local_surface_id, 2224 std::move(compositor_frame));
2255 std::move(compositor_frame));
2256 }
2257 // Make sure the parent connection gets the surface ID. 2225 // Make sure the parent connection gets the surface ID.
2258 wt_client2()->WaitForChangeCount(1); 2226 wt_client1()->WaitForChangeCount(1);
2259 // Verify that the submitted frame is for |window_2_101|. 2227 // Verify that the submitted frame is for |window_2_101|.
2260 EXPECT_EQ(window_2_101_in_ws2, 2228 EXPECT_EQ(window_2_101_in_ws1,
2261 changes2()->back().surface_id.frame_sink_id().client_id()); 2229 changes1()->back().surface_id.frame_sink_id().client_id());
2262 } 2230 }
2263 2231
2264 // Verifies when an unknown window with a known child is added to a hierarchy 2232 // Verifies when an unknown window with a known child is added to a hierarchy
2265 // the known child is identified in the WindowData. 2233 // the known child is identified in the WindowData.
2266 TEST_F(WindowTreeClientTest, AddUnknownWindowKnownParent) { 2234 TEST_F(WindowTreeClientTest, AddUnknownWindowKnownParent) {
2267 const Id window_1_100 = wt_client1()->NewWindow(100); 2235 const Id window_1_100 = wt_client1()->NewWindow(100);
2268 ASSERT_TRUE(window_1_100); 2236 ASSERT_TRUE(window_1_100);
2269 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100)); 2237 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100));
2270 2238
2271 // Establish the second client at 1,100. 2239 // Establish the second client at 1,100.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 2296
2329 // TODO(sky): make sure coverage of what was 2297 // TODO(sky): make sure coverage of what was
2330 // WindowManagerTest.SecondEmbedRoot_InitService and 2298 // WindowManagerTest.SecondEmbedRoot_InitService and
2331 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window 2299 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window
2332 // manager 2300 // manager
2333 // tests. 2301 // tests.
2334 2302
2335 } // namespace test 2303 } // namespace test
2336 } // namespace ws 2304 } // namespace ws
2337 } // namespace ui 2305 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.cc ('k') | ui/aura/local/window_port_local.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698