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

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

Issue 774763004: Use EXPECT_EQ when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "cc/layers/heads_up_display_layer_impl.h" 7 #include "cc/layers/heads_up_display_layer_impl.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 host_impl().SetViewportSize(root->bounds()); 457 host_impl().SetViewportSize(root->bounds());
458 host_impl().active_tree()->SetRootLayer(root.Pass()); 458 host_impl().active_tree()->SetRootLayer(root.Pass());
459 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 459 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
460 460
461 // Sanity check the scenario we just created. 461 // Sanity check the scenario we just created.
462 // The visible content rect for test_layer is actually 100x100, even though 462 // The visible content rect for test_layer is actually 100x100, even though
463 // its layout size is 50x50, positioned at 25x25. 463 // its layout size is 50x50, positioned at 25x25.
464 LayerImpl* test_layer = 464 LayerImpl* test_layer =
465 host_impl().active_tree()->root_layer()->children()[0]; 465 host_impl().active_tree()->root_layer()->children()[0];
466 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect()); 466 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect());
467 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 467 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
468 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 468 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
469 469
470 // Hit testing for a point outside the layer should return a null pointer (the 470 // Hit testing for a point outside the layer should return a null pointer (the
471 // root layer does not draw content, so it will not be hit tested either). 471 // root layer does not draw content, so it will not be hit tested either).
472 gfx::Point test_point(101, 101); 472 gfx::Point test_point(101, 101);
473 LayerImpl* result_layer = 473 LayerImpl* result_layer =
474 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 474 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
475 EXPECT_FALSE(result_layer); 475 EXPECT_FALSE(result_layer);
476 476
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 1690
1691 host_impl().SetViewportSize(root->bounds()); 1691 host_impl().SetViewportSize(root->bounds());
1692 host_impl().active_tree()->SetRootLayer(root.Pass()); 1692 host_impl().active_tree()->SetRootLayer(root.Pass());
1693 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1693 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1694 1694
1695 // Sanity check the scenario we just created. 1695 // Sanity check the scenario we just created.
1696 // The visible content rect for test_layer is actually 100x100, even though 1696 // The visible content rect for test_layer is actually 100x100, even though
1697 // its layout size is 50x50, positioned at 25x25. 1697 // its layout size is 50x50, positioned at 25x25.
1698 LayerImpl* test_layer = 1698 LayerImpl* test_layer =
1699 host_impl().active_tree()->root_layer()->children()[0]; 1699 host_impl().active_tree()->root_layer()->children()[0];
1700 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect()); 1700 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect());
1701 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1701 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1702 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1702 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1703 1703
1704 // Hit checking for a point outside the layer should return a null pointer 1704 // Hit checking for a point outside the layer should return a null pointer
1705 // (the root layer does not draw content, so it will not be tested either). 1705 // (the root layer does not draw content, so it will not be tested either).
1706 gfx::Point test_point(76, 76); 1706 gfx::Point test_point(76, 76);
1707 LayerImpl* result_layer = 1707 LayerImpl* result_layer =
1708 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( 1708 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
1709 test_point); 1709 test_point);
1710 EXPECT_FALSE(result_layer); 1710 EXPECT_FALSE(result_layer);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 1804
1805 // Sanity check the scenario we just created. 1805 // Sanity check the scenario we just created.
1806 // The visible content rect for test_layer is actually 100x100, even though 1806 // The visible content rect for test_layer is actually 100x100, even though
1807 // its layout size is 50x50, positioned at 25x25. 1807 // its layout size is 50x50, positioned at 25x25.
1808 LayerImpl* test_layer = 1808 LayerImpl* test_layer =
1809 host_impl().active_tree()->root_layer()->children()[0]; 1809 host_impl().active_tree()->root_layer()->children()[0];
1810 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1810 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1811 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1811 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1812 1812
1813 // Check whether the child layer fits into the root after scaled. 1813 // Check whether the child layer fits into the root after scaled.
1814 EXPECT_RECT_EQ(gfx::Rect(test_layer->content_bounds()), 1814 EXPECT_EQ(gfx::Rect(test_layer->content_bounds()),
1815 test_layer->visible_content_rect()); 1815 test_layer->visible_content_rect());
1816 1816
1817 // Hit checking for a point outside the layer should return a null pointer 1817 // Hit checking for a point outside the layer should return a null pointer
1818 // (the root layer does not draw content, so it will not be tested either). 1818 // (the root layer does not draw content, so it will not be tested either).
1819 gfx::PointF test_point(76.f, 76.f); 1819 gfx::PointF test_point(76.f, 76.f);
1820 test_point = 1820 test_point =
1821 gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor); 1821 gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
1822 LayerImpl* result_layer = 1822 LayerImpl* result_layer =
1823 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( 1823 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
1824 test_point); 1824 test_point);
1825 EXPECT_FALSE(result_layer); 1825 EXPECT_FALSE(result_layer);
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2358 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2359 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2359 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2360 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2360 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2361 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2361 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2362 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2362 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2363 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2363 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2364 } 2364 }
2365 2365
2366 } // namespace 2366 } // namespace
2367 } // namespace cc 2367 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698