OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/surfaces/display_compositor.h" | 5 #include "services/ui/surfaces/display_compositor.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 AddSurfaceReference(parent_id, surface_id2); | 278 AddSurfaceReference(parent_id, surface_id2); |
279 RunUntilIdle(); | 279 RunUntilIdle(); |
280 | 280 |
281 // The real reference should be added for 2:1:2 and both temporary references | 281 // The real reference should be added for 2:1:2 and both temporary references |
282 // should be removed. | 282 // should be removed. |
283 EXPECT_EQ("Add(1:1:1-2:1:2);Remove(0:0:0-2:1:2);Remove(0:0:0-2:1:1)", | 283 EXPECT_EQ("Add(1:1:1-2:1:2);Remove(0:0:0-2:1:2);Remove(0:0:0-2:1:1)", |
284 reference_manager_.events()); | 284 reference_manager_.events()); |
285 EXPECT_EQ(0u, CountTempReferences()); | 285 EXPECT_EQ(0u, CountTempReferences()); |
286 } | 286 } |
287 | 287 |
| 288 TEST_F(DisplayCompositorTest, RemoveFirstTempRefOnly) { |
| 289 const cc::SurfaceId parent_id = MakeSurfaceId(1, 1, 1); |
| 290 const cc::SurfaceId surface_id1 = MakeSurfaceId(2, 1, 1); |
| 291 const cc::SurfaceId surface_id2 = MakeSurfaceId(2, 1, 2); |
| 292 |
| 293 // Add two surfaces that have the same FrameSinkId. This would happen when a |
| 294 // client submits two CFs before parent submits a new CF. |
| 295 surface_observer()->OnSurfaceCreated( |
| 296 cc::SurfaceInfo(surface_id1, 1.0f, gfx::Size(1, 1))); |
| 297 surface_observer()->OnSurfaceCreated( |
| 298 cc::SurfaceInfo(surface_id2, 1.0f, gfx::Size(1, 1))); |
| 299 RunUntilIdle(); |
| 300 |
| 301 // Client should get OnSurfaceCreated call and temporary reference added for |
| 302 // both surfaces. |
| 303 EXPECT_EQ("OnSurfaceCreated(2:1:1);OnSurfaceCreated(2:1:2)", |
| 304 client_.events()); |
| 305 EXPECT_EQ("Add(0:0:0-2:1:1);Add(0:0:0-2:1:2)", reference_manager_.events()); |
| 306 EXPECT_EQ(2u, CountTempReferences()); |
| 307 |
| 308 // Add a reference to the surface with the earlier LocalFrameId. |
| 309 AddSurfaceReference(parent_id, surface_id1); |
| 310 RunUntilIdle(); |
| 311 |
| 312 // The real reference should be added for 2:1:1 and temporary reference |
| 313 // should be removed. The temporary reference for 2:1:2 should remain. |
| 314 EXPECT_EQ("Add(1:1:1-2:1:1);Remove(0:0:0-2:1:1)", |
| 315 reference_manager_.events()); |
| 316 EXPECT_EQ(1u, CountTempReferences()); |
| 317 } |
| 318 |
288 } // namespace test | 319 } // namespace test |
289 } // namespace ui | 320 } // namespace ui |
OLD | NEW |