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 "cc/layers/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
6 #include "cc/layers/heads_up_display_layer_impl.h" | 6 #include "cc/layers/heads_up_display_layer_impl.h" |
7 #include "cc/test/fake_impl_proxy.h" | 7 #include "cc/test/fake_impl_proxy.h" |
8 #include "cc/test/fake_layer_tree_host_impl.h" | 8 #include "cc/test/fake_layer_tree_host_impl.h" |
9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
10 #include "cc/test/test_shared_bitmap_manager.h" | 10 #include "cc/test/test_shared_bitmap_manager.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { | 33 TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { |
34 FakeImplProxy proxy; | 34 FakeImplProxy proxy; |
35 TestSharedBitmapManager shared_bitmap_manager; | 35 TestSharedBitmapManager shared_bitmap_manager; |
36 TestTaskGraphRunner task_graph_runner; | 36 TestTaskGraphRunner task_graph_runner; |
37 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 37 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
38 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 38 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, |
39 &task_graph_runner); | 39 &task_graph_runner); |
40 host_impl.CreatePendingTree(); | 40 host_impl.CreatePendingTree(); |
| 41 host_impl.SetVisible(true); |
41 host_impl.InitializeRenderer(output_surface.get()); | 42 host_impl.InitializeRenderer(output_surface.get()); |
42 scoped_ptr<HeadsUpDisplayLayerImpl> layer = | 43 scoped_ptr<HeadsUpDisplayLayerImpl> layer = |
43 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); | 44 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); |
44 layer->SetBounds(gfx::Size(100, 100)); | 45 layer->SetBounds(gfx::Size(100, 100)); |
45 | 46 |
46 // Check regular hardware draw is ok. | 47 // Check regular hardware draw is ok. |
47 CheckDrawLayer( | 48 CheckDrawLayer( |
48 layer.get(), host_impl.resource_provider(), DRAW_MODE_HARDWARE); | 49 layer.get(), host_impl.resource_provider(), DRAW_MODE_HARDWARE); |
49 | 50 |
50 // Simulate a resource loss on transitioning to resourceless software mode. | 51 // Simulate a resource loss on transitioning to resourceless software mode. |
51 layer->ReleaseResources(); | 52 layer->ReleaseResources(); |
52 | 53 |
53 // Should skip resourceless software draw and not crash in UpdateHudTexture. | 54 // Should skip resourceless software draw and not crash in UpdateHudTexture. |
54 CheckDrawLayer(layer.get(), | 55 CheckDrawLayer(layer.get(), |
55 host_impl.resource_provider(), | 56 host_impl.resource_provider(), |
56 DRAW_MODE_RESOURCELESS_SOFTWARE); | 57 DRAW_MODE_RESOURCELESS_SOFTWARE); |
57 } | 58 } |
58 | 59 |
59 } // namespace | 60 } // namespace |
60 } // namespace cc | 61 } // namespace cc |
OLD | NEW |