Chromium Code Reviews| 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 "cc/surfaces/surface.h" | 5 #include "cc/surfaces/surface.h" |
| 6 #include "cc/surfaces/surface_factory.h" | 6 #include "cc/surfaces/surface_factory.h" |
| 7 #include "cc/surfaces/surface_factory_client.h" | 7 #include "cc/surfaces/surface_factory_client.h" |
| 8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 #include "cc/test/scheduler_test_common.h" | 10 #include "cc/test/scheduler_test_common.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 TEST(SurfaceTest, SurfaceLifetime) { | 35 TEST(SurfaceTest, SurfaceLifetime) { |
| 36 SurfaceManager manager; | 36 SurfaceManager manager; |
| 37 FakeSurfaceFactoryClient surface_factory_client; | 37 FakeSurfaceFactoryClient surface_factory_client; |
| 38 SurfaceFactory factory(kArbitraryFrameSinkId, &manager, | 38 SurfaceFactory factory(kArbitraryFrameSinkId, &manager, |
| 39 &surface_factory_client); | 39 &surface_factory_client); |
| 40 | 40 |
| 41 LocalFrameId local_frame_id(6, base::UnguessableToken::Create()); | 41 LocalFrameId local_frame_id(6, base::UnguessableToken::Create()); |
| 42 SurfaceId surface_id(kArbitraryFrameSinkId, local_frame_id); | 42 SurfaceId surface_id(kArbitraryFrameSinkId, local_frame_id); |
| 43 { | 43 { |
|
danakj
2016/11/15 00:43:41
nit: these {} are pointless but distract from what
Saman Sami
2016/11/15 21:12:19
Done.
| |
| 44 factory.Create(local_frame_id); | 44 factory.SubmitCompositorFrame(local_frame_id, CompositorFrame(), |
| 45 SurfaceFactory::DrawCallback()); | |
| 45 EXPECT_TRUE(manager.GetSurfaceForId(surface_id)); | 46 EXPECT_TRUE(manager.GetSurfaceForId(surface_id)); |
| 46 factory.Destroy(local_frame_id); | 47 factory.EvictSurface(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 EXPECT_EQ(NULL, manager.GetSurfaceForId(surface_id)); | 50 EXPECT_EQ(NULL, manager.GetSurfaceForId(surface_id)); |
| 50 } | 51 } |
| 51 | 52 |
| 52 TEST(SurfaceTest, SurfaceIds) { | 53 TEST(SurfaceTest, SurfaceIds) { |
| 53 for (size_t i = 0; i < 3; ++i) { | 54 for (size_t i = 0; i < 3; ++i) { |
| 54 SurfaceIdAllocator allocator; | 55 SurfaceIdAllocator allocator; |
| 55 LocalFrameId id1 = allocator.GenerateId(); | 56 LocalFrameId id1 = allocator.GenerateId(); |
| 56 LocalFrameId id2 = allocator.GenerateId(); | 57 LocalFrameId id2 = allocator.GenerateId(); |
| 57 EXPECT_NE(id1, id2); | 58 EXPECT_NE(id1, id2); |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace | 62 } // namespace |
| 62 } // namespace cc | 63 } // namespace cc |
| OLD | NEW |