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

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: Moved define to layer_test_common.h 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') | cc/test/layer_test_common.h » ('j') | 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..55b4c738d22656ee99fdf9731f1040d14bd59391 100644
--- a/cc/layers/texture_layer_unittest.cc
+++ b/cc/layers/texture_layer_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
+#include "cc/test/layer_test_common.h"
#include "cc/test/layer_tree_test.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
@@ -181,6 +182,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') | cc/test/layer_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698