Index: cc/layers/texture_layer_unittest.cc |
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc |
index c6a45499c88116f16e44442fa319f27cfe55aad8..58116744b2c835a1311a13050c48d0887df3249c 100644 |
--- a/cc/layers/texture_layer_unittest.cc |
+++ b/cc/layers/texture_layer_unittest.cc |
@@ -25,6 +25,12 @@ using ::testing::_; |
using ::testing::AtLeast; |
using ::testing::AnyNumber; |
+#define EXPECT_SET_NEEDS_COMMIT(expect, code_to_test) do { \ |
David Trainor- moved to gerrit
2013/04/18 20:33:44
I copied this from layer_unittest.cc. Is there a
enne (OOO)
2013/04/18 20:40:14
You could move it to layer_test_common.h if you wa
|
+ EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times((expect)); \ |
+ code_to_test; \ |
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
+ } while (false) |
+ |
namespace cc { |
namespace { |
@@ -181,6 +187,24 @@ TEST_F(TextureLayerTest, SyncImplWhenRemovingFromTree) { |
Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
} |
+TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
+ scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); |
+ test_layer->SetLayerTreeHost(layer_tree_host_.get()); |
+ |
+ // Test properties that should call SetNeedsCommit. All properties need to |
+ // be set to new values in order for SetNeedsCommit to be called. |
+ EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFlipped(false)); |
+ EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUV( |
+ gfx::PointF(0.25f, 0.25f), gfx::PointF(0.75f, 0.75f))); |
+ EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetVertexOpacity( |
+ 0.5f, 0.5f, 0.5f, 0.5f)); |
+ EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPremultipliedAlpha(false)); |
+ EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTextureId(1)); |
+ |
+ // Calling SetTextureId can call AcquireLayerTextures. |
+ EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AnyNumber()); |
+} |
+ |
class MockMailboxCallback { |
public: |
MOCK_METHOD3(Release, void(const std::string& mailbox, |