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

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

Issue 1565783002: Revert of Determine a layer's IsAffectedByPageScale property without using Layer Tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | cc/layers/layer.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"
11 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/test_shared_bitmap_manager.h" 12 #include "cc/test/test_shared_bitmap_manager.h"
13 #include "cc/test/test_task_graph_runner.h" 13 #include "cc/test/test_task_graph_runner.h"
14 #include "cc/trees/layer_tree_impl.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 15
17 namespace cc { 16 namespace cc {
18 namespace { 17 namespace {
19 18
20 void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer, 19 void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer,
21 ResourceProvider* resource_provider, 20 ResourceProvider* resource_provider,
22 DrawMode draw_mode) { 21 DrawMode draw_mode) {
23 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 22 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
24 AppendQuadsData data; 23 AppendQuadsData data;
(...skipping 15 matching lines...) Expand all
40 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 39 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
41 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 40 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
42 &task_graph_runner); 41 &task_graph_runner);
43 host_impl.CreatePendingTree(); 42 host_impl.CreatePendingTree();
44 host_impl.SetVisible(true); 43 host_impl.SetVisible(true);
45 host_impl.InitializeRenderer(output_surface.get()); 44 host_impl.InitializeRenderer(output_surface.get());
46 scoped_ptr<HeadsUpDisplayLayerImpl> layer = 45 scoped_ptr<HeadsUpDisplayLayerImpl> layer =
47 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); 46 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1);
48 layer->SetBounds(gfx::Size(100, 100)); 47 layer->SetBounds(gfx::Size(100, 100));
49 48
50 HeadsUpDisplayLayerImpl* layer_ptr = layer.get();
51
52 host_impl.pending_tree()->SetRootLayer(std::move(layer));
53 host_impl.pending_tree()->BuildPropertyTreesForTesting();
54
55 // Check regular hardware draw is ok. 49 // Check regular hardware draw is ok.
56 CheckDrawLayer(layer_ptr, host_impl.resource_provider(), DRAW_MODE_HARDWARE); 50 CheckDrawLayer(
51 layer.get(), host_impl.resource_provider(), DRAW_MODE_HARDWARE);
57 52
58 // Simulate a resource loss on transitioning to resourceless software mode. 53 // Simulate a resource loss on transitioning to resourceless software mode.
59 layer_ptr->ReleaseResources(); 54 layer->ReleaseResources();
60 55
61 // Should skip resourceless software draw and not crash in UpdateHudTexture. 56 // Should skip resourceless software draw and not crash in UpdateHudTexture.
62 CheckDrawLayer(layer_ptr, host_impl.resource_provider(), 57 CheckDrawLayer(layer.get(),
58 host_impl.resource_provider(),
63 DRAW_MODE_RESOURCELESS_SOFTWARE); 59 DRAW_MODE_RESOURCELESS_SOFTWARE);
64 } 60 }
65 61
66 } // namespace 62 } // namespace
67 } // namespace cc 63 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698