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

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

Issue 1544103002: 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, 12 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') | cc/trees/property_tree_builder.cc » ('J')
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"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace cc { 17 namespace cc {
17 namespace { 18 namespace {
18 19
19 void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer, 20 void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer,
20 ResourceProvider* resource_provider, 21 ResourceProvider* resource_provider,
21 DrawMode draw_mode) { 22 DrawMode draw_mode) {
22 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 23 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
23 AppendQuadsData data; 24 AppendQuadsData data;
(...skipping 15 matching lines...) Expand all
39 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 40 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
40 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 41 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
41 &task_graph_runner); 42 &task_graph_runner);
42 host_impl.CreatePendingTree(); 43 host_impl.CreatePendingTree();
43 host_impl.SetVisible(true); 44 host_impl.SetVisible(true);
44 host_impl.InitializeRenderer(output_surface.get()); 45 host_impl.InitializeRenderer(output_surface.get());
45 scoped_ptr<HeadsUpDisplayLayerImpl> layer = 46 scoped_ptr<HeadsUpDisplayLayerImpl> layer =
46 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); 47 HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1);
47 layer->SetBounds(gfx::Size(100, 100)); 48 layer->SetBounds(gfx::Size(100, 100));
48 49
50 HeadsUpDisplayLayerImpl* layer_ptr = layer.get();
51
52 layer->UpdatePropertyTreeTransform();
ajuma 2015/12/23 22:17:04 This line shouldn't be needed (since property tree
53 host_impl.pending_tree()->SetRootLayer(std::move(layer));
54 host_impl.pending_tree()->BuildPropertyTreesForTesting();
55
49 // Check regular hardware draw is ok. 56 // Check regular hardware draw is ok.
50 CheckDrawLayer( 57 CheckDrawLayer(layer_ptr, host_impl.resource_provider(), DRAW_MODE_HARDWARE);
51 layer.get(), host_impl.resource_provider(), DRAW_MODE_HARDWARE);
52 58
53 // Simulate a resource loss on transitioning to resourceless software mode. 59 // Simulate a resource loss on transitioning to resourceless software mode.
54 layer->ReleaseResources(); 60 layer_ptr->ReleaseResources();
55 61
56 // Should skip resourceless software draw and not crash in UpdateHudTexture. 62 // Should skip resourceless software draw and not crash in UpdateHudTexture.
57 CheckDrawLayer(layer.get(), 63 CheckDrawLayer(layer_ptr, host_impl.resource_provider(),
58 host_impl.resource_provider(),
59 DRAW_MODE_RESOURCELESS_SOFTWARE); 64 DRAW_MODE_RESOURCELESS_SOFTWARE);
60 } 65 }
61 66
62 } // namespace 67 } // namespace
63 } // namespace cc 68 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer.cc » ('j') | cc/trees/property_tree_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698