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/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 // PicturePile uses the source frame number as a unit for measuring invalidation | 121 // PicturePile uses the source frame number as a unit for measuring invalidation |
122 // frequency. When a pile moves between compositors, the frame number increases | 122 // frequency. When a pile moves between compositors, the frame number increases |
123 // non-monotonically. This executes that code path under this scenario allowing | 123 // non-monotonically. This executes that code path under this scenario allowing |
124 // for the code to verify correctness with DCHECKs. | 124 // for the code to verify correctness with DCHECKs. |
125 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { | 125 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { |
126 LayerTreeSettings settings; | 126 LayerTreeSettings settings; |
127 settings.single_thread_proxy_scheduler = false; | 127 settings.single_thread_proxy_scheduler = false; |
128 settings.use_zero_copy = true; | 128 settings.use_zero_copy = true; |
129 settings.use_one_copy = false; | |
130 | 129 |
131 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); | 130 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); |
132 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); | 131 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); |
133 TestSharedBitmapManager shared_bitmap_manager; | 132 TestSharedBitmapManager shared_bitmap_manager; |
134 TestTaskGraphRunner task_graph_runner; | 133 TestTaskGraphRunner task_graph_runner; |
135 | 134 |
136 MockContentLayerClient client; | 135 MockContentLayerClient client; |
137 scoped_refptr<FakePictureLayer> layer = | 136 scoped_refptr<FakePictureLayer> layer = |
138 FakePictureLayer::Create(LayerSettings(), &client); | 137 FakePictureLayer::Create(LayerSettings(), &client); |
139 | 138 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Do a main frame, record the picture layers. The frame number has changed | 173 // Do a main frame, record the picture layers. The frame number has changed |
175 // non-monotonically. | 174 // non-monotonically. |
176 layer->SetNeedsDisplay(); | 175 layer->SetNeedsDisplay(); |
177 host2->Composite(base::TimeTicks::Now()); | 176 host2->Composite(base::TimeTicks::Now()); |
178 EXPECT_EQ(3, layer->update_count()); | 177 EXPECT_EQ(3, layer->update_count()); |
179 EXPECT_EQ(1, host2->source_frame_number()); | 178 EXPECT_EQ(1, host2->source_frame_number()); |
180 } | 179 } |
181 | 180 |
182 } // namespace | 181 } // namespace |
183 } // namespace cc | 182 } // namespace cc |
OLD | NEW |