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

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

Issue 375093002: Initial attempt at counting layers in the compositor thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use LayerTreeImpl::layer_id_map_.size() and fix histogram name Created 6 years, 5 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 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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 EXPECT_EQ(left_input.layer_rect, left_output.viewport_rect); 2312 EXPECT_EQ(left_input.layer_rect, left_output.viewport_rect);
2313 EXPECT_TRUE(left_output.visible); 2313 EXPECT_TRUE(left_output.visible);
2314 EXPECT_EQ(right_input.type, right_output.type); 2314 EXPECT_EQ(right_input.type, right_output.type);
2315 gfx::RectF expected_right_output_rect = right_input.layer_rect; 2315 gfx::RectF expected_right_output_rect = right_input.layer_rect;
2316 expected_right_output_rect.Offset(sub_layer_offset); 2316 expected_right_output_rect.Offset(sub_layer_offset);
2317 expected_right_output_rect.Scale(page_scale_factor); 2317 expected_right_output_rect.Scale(page_scale_factor);
2318 EXPECT_EQ(expected_right_output_rect, right_output.viewport_rect); 2318 EXPECT_EQ(expected_right_output_rect, right_output.viewport_rect);
2319 EXPECT_TRUE(right_output.visible); 2319 EXPECT_TRUE(right_output.visible);
2320 } 2320 }
2321 2321
2322 TEST_F(LayerTreeImplTest, NumLayersTestZero) {
2323 CHECK_EQ(0u, host_impl().active_tree()->NumLayers());
2324 }
2325
2326 TEST_F(LayerTreeImplTest, NumLayersTestOne) {
2327 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2328 host_impl().active_tree()->SetRootLayer(root.Pass());
danakj 2014/07/10 21:27:44 how about just EXPECT 0 before setting the root la
dneto 2014/07/11 15:23:31 Acknowledged.
2329 CHECK_EQ(1u, host_impl().active_tree()->NumLayers());
danakj 2014/07/10 21:27:44 EXPECT_EQ not CHECK_EQ in a test
dneto 2014/07/11 15:23:31 Ouch! Thanks.
2330 }
2331
2332 TEST_F(LayerTreeImplTest, NumLayersSmallTree) {
2333 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2334 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2335 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2336 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2337 host_impl().active_tree()->SetRootLayer(root.Pass());
danakj 2014/07/10 21:27:44 can you EXPECT 0 before doing the set root so we c
dneto 2014/07/11 15:23:31 Acknowledged.
2338 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2339 }
2340
2322 } // namespace 2341 } // namespace
2323 } // namespace cc 2342 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698