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

Unified Diff: cc/layers/texture_layer_unittest.cc

Issue 13910011: Add optimization to TextureLayer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unitt est Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698