Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: cc/layers/heads_up_display_layer_impl_unittest.cc

Issue 2171143002: cc: Get rid of non-delegated rendering in most cc unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@killdirecttests
Patch Set: fakeoutputsurface: no-constructor Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/debug/micro_benchmark_controller_unittest.cc ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/debug/micro_benchmark_controller_unittest.cc ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698