OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 #include "cc/resources/layer_painter.h" | 10 #include "cc/resources/layer_painter.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); | 475 EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); |
476 test_layer->ResetNeedsDisplayForTesting(); | 476 test_layer->ResetNeedsDisplayForTesting(); |
477 | 477 |
478 // Case 2: SetNeedsDisplay() without the dirty rect arg. | 478 // Case 2: SetNeedsDisplay() without the dirty rect arg. |
479 test_layer->ResetNeedsDisplayForTesting(); | 479 test_layer->ResetNeedsDisplayForTesting(); |
480 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); | 480 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
481 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNeedsDisplay()); | 481 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNeedsDisplay()); |
482 EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); | 482 EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); |
483 test_layer->ResetNeedsDisplayForTesting(); | 483 test_layer->ResetNeedsDisplayForTesting(); |
484 | 484 |
485 // Case 3: SetNeedsDisplay() with a non-drawable layer | 485 // Case 3: SetNeedsDisplay() with an empty rect. |
| 486 test_layer->ResetNeedsDisplayForTesting(); |
| 487 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
| 488 EXPECT_SET_NEEDS_COMMIT(0, test_layer->SetNeedsDisplayRect(gfx::Rect())); |
| 489 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
| 490 |
| 491 // Case 4: SetNeedsDisplay() with a non-drawable layer |
486 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(false)); | 492 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(false)); |
487 test_layer->ResetNeedsDisplayForTesting(); | 493 test_layer->ResetNeedsDisplayForTesting(); |
488 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); | 494 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
489 EXPECT_SET_NEEDS_COMMIT(0, test_layer->SetNeedsDisplayRect(dirty1)); | 495 EXPECT_SET_NEEDS_COMMIT(0, test_layer->SetNeedsDisplayRect(dirty1)); |
490 EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); | 496 EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); |
491 } | 497 } |
492 | 498 |
493 TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { | 499 TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
494 scoped_refptr<Layer> test_layer = Layer::Create(); | 500 scoped_refptr<Layer> test_layer = Layer::Create(); |
495 test_layer->SetLayerTreeHost(layer_tree_host_.get()); | 501 test_layer->SetLayerTreeHost(layer_tree_host_.get()); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " | 1004 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " |
999 << host_opaque << "\n"; | 1005 << host_opaque << "\n"; |
1000 } | 1006 } |
1001 } | 1007 } |
1002 } | 1008 } |
1003 } | 1009 } |
1004 } | 1010 } |
1005 | 1011 |
1006 } // namespace | 1012 } // namespace |
1007 } // namespace cc | 1013 } // namespace cc |
OLD | NEW |