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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/test/fake_content_layer_client.h" | 7 #include "cc/test/fake_content_layer_client.h" |
8 #include "cc/test/fake_picture_layer.h" | 8 #include "cc/test/fake_picture_layer.h" |
9 #include "cc/test/fake_picture_layer_impl.h" | 9 #include "cc/test/fake_picture_layer_impl.h" |
10 #include "cc/test/layer_tree_test.h" | 10 #include "cc/test/layer_tree_test.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 picture_id1_ = root_picture_layer_->id(); | 39 picture_id1_ = root_picture_layer_->id(); |
40 picture_id2_ = -1; | 40 picture_id2_ = -1; |
41 } | 41 } |
42 | 42 |
43 void BeginTest() override { | 43 void BeginTest() override { |
44 activates_ = 0; | 44 activates_ = 0; |
45 PostSetNeedsCommitToMainThread(); | 45 PostSetNeedsCommitToMainThread(); |
46 } | 46 } |
47 | 47 |
48 void DidCommit() override { | 48 void DidCommit() override { |
49 switch (layer_tree_host()->source_frame_number()) { | 49 switch (layer_tree_host()->SourceFrameNumber()) { |
50 case 1: | 50 case 1: |
51 // Activate while there are pending and active twins in place. | 51 // Activate while there are pending and active twins in place. |
52 layer_tree_host()->SetNeedsCommit(); | 52 layer_tree_host()->SetNeedsCommit(); |
53 break; | 53 break; |
54 case 2: | 54 case 2: |
55 // Drop the picture layer from the tree so the activate will have an | 55 // Drop the picture layer from the tree so the activate will have an |
56 // active layer without a pending twin. | 56 // active layer without a pending twin. |
57 root_picture_layer_->RemoveFromParent(); | 57 root_picture_layer_->RemoveFromParent(); |
58 break; | 58 break; |
59 case 3: { | 59 case 3: { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 EXPECT_EQ(gfx::Size(768, 256), tile_size); | 178 EXPECT_EQ(gfx::Size(768, 256), tile_size); |
179 break; | 179 break; |
180 case 1: | 180 case 1: |
181 // When the viewport changed size, the new frame's tiles should change | 181 // When the viewport changed size, the new frame's tiles should change |
182 // along with it. | 182 // along with it. |
183 EXPECT_NE(gfx::Size(768, 256), tile_size); | 183 EXPECT_NE(gfx::Size(768, 256), tile_size); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 void DidCommit() override { | 187 void DidCommit() override { |
188 switch (layer_tree_host()->source_frame_number()) { | 188 switch (layer_tree_host()->SourceFrameNumber()) { |
189 case 1: | 189 case 1: |
190 // Change the picture layer's size along with the viewport, so it will | 190 // Change the picture layer's size along with the viewport, so it will |
191 // consider picking a new tile size. | 191 // consider picking a new tile size. |
192 picture_->SetBounds(gfx::Size(768, 1056)); | 192 picture_->SetBounds(gfx::Size(768, 1056)); |
193 layer_tree()->SetViewportSize(gfx::Size(768, 1056)); | 193 layer_tree()->SetViewportSize(gfx::Size(768, 1056)); |
194 break; | 194 break; |
195 case 2: | 195 case 2: |
196 EndTest(); | 196 EndTest(); |
197 } | 197 } |
198 } | 198 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 EXPECT_GT(picture->tilings()->num_tilings(), 0u); | 379 EXPECT_GT(picture->tilings()->num_tilings(), 0u); |
380 break; | 380 break; |
381 case 2: | 381 case 2: |
382 // On 3rd commit, the layer is visible again, so has tilings. | 382 // On 3rd commit, the layer is visible again, so has tilings. |
383 EXPECT_GT(picture->tilings()->num_tilings(), 0u); | 383 EXPECT_GT(picture->tilings()->num_tilings(), 0u); |
384 EndTest(); | 384 EndTest(); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 void DidCommit() override { | 388 void DidCommit() override { |
389 switch (layer_tree_host()->source_frame_number()) { | 389 switch (layer_tree_host()->SourceFrameNumber()) { |
390 case 1: | 390 case 1: |
391 // For the 2nd commit, change opacity to 0 so that the layer will not be | 391 // For the 2nd commit, change opacity to 0 so that the layer will not be |
392 // part of the visible frame. | 392 // part of the visible frame. |
393 child_->SetOpacity(0.f); | 393 child_->SetOpacity(0.f); |
394 break; | 394 break; |
395 case 2: | 395 case 2: |
396 // For the 3rd commit, change opacity to 1 so that the layer will again | 396 // For the 3rd commit, change opacity to 1 so that the layer will again |
397 // be part of the visible frame. | 397 // be part of the visible frame. |
398 child_->SetOpacity(1.f); | 398 child_->SetOpacity(1.f); |
399 } | 399 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 int last_frame_drawn_; | 571 int last_frame_drawn_; |
572 bool ready_to_draw_; | 572 bool ready_to_draw_; |
573 }; | 573 }; |
574 | 574 |
575 // Multi-thread only because in single thread you can't pinch zoom on the | 575 // Multi-thread only because in single thread you can't pinch zoom on the |
576 // compositor thread. | 576 // compositor thread. |
577 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); | 577 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); |
578 | 578 |
579 } // namespace | 579 } // namespace |
580 } // namespace cc | 580 } // namespace cc |
OLD | NEW |