| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 6 |
| 7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
| 8 #include "cc/layers/heads_up_display_layer_impl.h" | 8 #include "cc/layers/heads_up_display_layer_impl.h" |
| 9 #include "cc/test/fake_impl_task_runner_provider.h" | 9 #include "cc/test/fake_impl_task_runner_provider.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 layer->DidDraw(resource_provider); | 30 layer->DidDraw(resource_provider); |
| 31 | 31 |
| 32 size_t expected_quad_list_size = will_draw ? 1 : 0; | 32 size_t expected_quad_list_size = will_draw ? 1 : 0; |
| 33 EXPECT_EQ(expected_quad_list_size, render_pass->quad_list.size()); | 33 EXPECT_EQ(expected_quad_list_size, render_pass->quad_list.size()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { | 36 TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { |
| 37 FakeImplTaskRunnerProvider task_runner_provider; | 37 FakeImplTaskRunnerProvider task_runner_provider; |
| 38 TestSharedBitmapManager shared_bitmap_manager; | 38 TestSharedBitmapManager shared_bitmap_manager; |
| 39 TestTaskGraphRunner task_graph_runner; | 39 TestTaskGraphRunner task_graph_runner; |
| 40 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 40 std::unique_ptr<OutputSurface> output_surface = |
| 41 FakeOutputSurface::CreateDelegating3d(); |
| 41 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 42 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 42 &task_graph_runner); | 43 &task_graph_runner); |
| 43 host_impl.CreatePendingTree(); | 44 host_impl.CreatePendingTree(); |
| 44 host_impl.SetVisible(true); | 45 host_impl.SetVisible(true); |
| 45 host_impl.InitializeRenderer(output_surface.get()); | 46 host_impl.InitializeRenderer(output_surface.get()); |
| 46 std::unique_ptr<HeadsUpDisplayLayerImpl> layer_ptr = | 47 std::unique_ptr<HeadsUpDisplayLayerImpl> layer_ptr = |
| 47 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); | 48 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); |
| 48 layer_ptr->SetBounds(gfx::Size(100, 100)); | 49 layer_ptr->SetBounds(gfx::Size(100, 100)); |
| 49 | 50 |
| 50 HeadsUpDisplayLayerImpl* layer = layer_ptr.get(); | 51 HeadsUpDisplayLayerImpl* layer = layer_ptr.get(); |
| 51 | 52 |
| 52 host_impl.pending_tree()->SetRootLayerForTesting(std::move(layer_ptr)); | 53 host_impl.pending_tree()->SetRootLayerForTesting(std::move(layer_ptr)); |
| 53 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting(); | 54 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 54 | 55 |
| 55 // Check regular hardware draw is ok. | 56 // Check regular hardware draw is ok. |
| 56 CheckDrawLayer(layer, host_impl.resource_provider(), DRAW_MODE_HARDWARE); | 57 CheckDrawLayer(layer, host_impl.resource_provider(), DRAW_MODE_HARDWARE); |
| 57 | 58 |
| 58 // Simulate a resource loss on transitioning to resourceless software mode. | 59 // Simulate a resource loss on transitioning to resourceless software mode. |
| 59 layer->ReleaseResources(); | 60 layer->ReleaseResources(); |
| 60 | 61 |
| 61 // Should skip resourceless software draw and not crash in UpdateHudTexture. | 62 // Should skip resourceless software draw and not crash in UpdateHudTexture. |
| 62 CheckDrawLayer(layer, host_impl.resource_provider(), | 63 CheckDrawLayer(layer, host_impl.resource_provider(), |
| 63 DRAW_MODE_RESOURCELESS_SOFTWARE); | 64 DRAW_MODE_RESOURCELESS_SOFTWARE); |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // namespace | 67 } // namespace |
| 67 } // namespace cc | 68 } // namespace cc |
| OLD | NEW |