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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1577263004: Communicate whether passive event listeners exist to cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners
Patch Set: Fix Android/ChromeOS build problems with bit packed enum class Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 8863 matching lines...) Expand 10 before | Expand all | Expand 10 after
8874 8874
8875 gfx::Transform identity; 8875 gfx::Transform identity;
8876 8876
8877 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), 8877 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
8878 gfx::Size(100, 100), true, false, true); 8878 gfx::Size(100, 100), true, false, true);
8879 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 8879 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
8880 gfx::Size(100, 100), true, false, false); 8880 gfx::Size(100, 100), true, false, false);
8881 8881
8882 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); 8882 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false);
8883 8883
8884 child->SetHaveWheelEventHandlers(true); 8884 child->SetWheelEventProperties(EventListenerProperties::BLOCKING);
8885 ExecuteCalculateDrawProperties(root); 8885 ExecuteCalculateDrawProperties(root);
8886 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); 8886 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true);
8887 8887
8888 child->SetHaveWheelEventHandlers(false); 8888 child->SetWheelEventProperties(EventListenerProperties::PASSIVE);
8889 ExecuteCalculateDrawProperties(root);
8890 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true);
8891
8892 child->SetWheelEventProperties(EventListenerProperties::BLOCKING |
8893 EventListenerProperties::PASSIVE);
8894 ExecuteCalculateDrawProperties(root);
8895 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true);
8896
8897 child->SetWheelEventProperties(EventListenerProperties::NONE);
8889 ExecuteCalculateDrawProperties(root); 8898 ExecuteCalculateDrawProperties(root);
8890 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); 8899 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false);
8891 } 8900 }
8892 8901
8893 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { 8902 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) {
8894 gfx::Transform identity; 8903 gfx::Transform identity;
8895 gfx::Transform translate_z; 8904 gfx::Transform translate_z;
8896 translate_z.Translate3d(0, 0, 10); 8905 translate_z.Translate3d(0, 0, 10);
8897 8906
8898 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 8907 scoped_refptr<Layer> root = Layer::Create(layer_settings());
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
9374 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), 9383 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(),
9375 gfx::PointF(), gfx::Size(30, 30), true, false, 9384 gfx::PointF(), gfx::Size(30, 30), true, false,
9376 true); 9385 true);
9377 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), 9386 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(),
9378 gfx::PointF(), gfx::Size(20, 20), true, false, 9387 gfx::PointF(), gfx::Size(20, 20), true, false,
9379 false); 9388 false);
9380 9389
9381 render_surface->SetMasksToBounds(true); 9390 render_surface->SetMasksToBounds(true);
9382 test_layer->SetDrawsContent(true); 9391 test_layer->SetDrawsContent(true);
9383 test_layer->SetOpacity(0); 9392 test_layer->SetOpacity(0);
9384 test_layer->SetHaveWheelEventHandlers(true); 9393 test_layer->SetWheelEventProperties(EventListenerProperties::BLOCKING);
9385 9394
9386 ExecuteCalculateDrawProperties(root); 9395 ExecuteCalculateDrawProperties(root);
9387 EXPECT_EQ(gfx::Rect(20, 20), test_layer->drawable_content_rect()); 9396 EXPECT_EQ(gfx::Rect(20, 20), test_layer->drawable_content_rect());
9388 EXPECT_EQ(gfx::RectF(20, 20), 9397 EXPECT_EQ(gfx::RectF(20, 20),
9389 render_surface->render_surface()->DrawableContentRect()); 9398 render_surface->render_surface()->DrawableContentRect());
9390 } 9399 }
9391 9400
9392 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { 9401 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) {
9393 LayerImpl* root = root_layer(); 9402 LayerImpl* root = root_layer();
9394 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 9403 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
9593 bool root_in_rsll = 9602 bool root_in_rsll =
9594 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); 9603 std::find(rsll->begin(), rsll->end(), root) != rsll->end();
9595 EXPECT_TRUE(root_in_rsll); 9604 EXPECT_TRUE(root_in_rsll);
9596 bool render_surface2_in_rsll = 9605 bool render_surface2_in_rsll =
9597 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); 9606 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end();
9598 EXPECT_FALSE(render_surface2_in_rsll); 9607 EXPECT_FALSE(render_surface2_in_rsll);
9599 } 9608 }
9600 9609
9601 } // namespace 9610 } // namespace
9602 } // namespace cc 9611 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698