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 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { | 32 TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { |
33 FakeImplProxy proxy; | 33 FakeImplProxy proxy; |
34 TestSharedBitmapManager shared_bitmap_manager; | 34 TestSharedBitmapManager shared_bitmap_manager; |
35 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 35 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); |
36 host_impl.CreatePendingTree(); | 36 host_impl.CreatePendingTree(); |
37 host_impl.InitializeRenderer(FakeOutputSurface::Create3d()); | 37 host_impl.InitializeRenderer(FakeOutputSurface::Create3d()); |
38 scoped_ptr<HeadsUpDisplayLayerImpl> layer = | 38 scoped_ptr<HeadsUpDisplayLayerImpl> layer = |
39 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); | 39 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); |
40 layer->SetContentBounds(gfx::Size(100, 100)); | 40 layer->SetBounds(gfx::Size(100, 100)); |
| 41 layer->draw_properties().ideal_contents_scale = 1.f; |
41 | 42 |
42 // Check regular hardware draw is ok. | 43 // Check regular hardware draw is ok. |
43 CheckDrawLayer( | 44 CheckDrawLayer( |
44 layer.get(), host_impl.resource_provider(), DRAW_MODE_HARDWARE); | 45 layer.get(), host_impl.resource_provider(), DRAW_MODE_HARDWARE); |
45 | 46 |
46 // Simulate a resource loss on transitioning to resourceless software mode. | 47 // Simulate a resource loss on transitioning to resourceless software mode. |
47 layer->ReleaseResources(); | 48 layer->ReleaseResources(); |
48 | 49 |
49 // Should skip resourceless software draw and not crash in UpdateHudTexture. | 50 // Should skip resourceless software draw and not crash in UpdateHudTexture. |
50 CheckDrawLayer(layer.get(), | 51 CheckDrawLayer(layer.get(), |
51 host_impl.resource_provider(), | 52 host_impl.resource_provider(), |
52 DRAW_MODE_RESOURCELESS_SOFTWARE); | 53 DRAW_MODE_RESOURCELESS_SOFTWARE); |
53 } | 54 } |
54 | 55 |
55 } // namespace | 56 } // namespace |
56 } // namespace cc | 57 } // namespace cc |
OLD | NEW |