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

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

Issue 1811423002: SubtreeShouldBeSkipped uses information from property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows compile failure Created 4 years, 9 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/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/test/fake_impl_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 input.end.type = SELECTION_BOUND_RIGHT; 2349 input.end.type = SELECTION_BOUND_RIGHT;
2350 input.end.edge_top = gfx::Point(50, 10); 2350 input.end.edge_top = gfx::Point(50, 10);
2351 input.end.edge_bottom = gfx::Point(50, 30); 2351 input.end.edge_bottom = gfx::Point(50, 30);
2352 input.end.layer_id = grand_child_id; 2352 input.end.layer_id = grand_child_id;
2353 2353
2354 host_impl().active_tree()->RegisterSelection(input); 2354 host_impl().active_tree()->RegisterSelection(input);
2355 2355
2356 ViewportSelection output; 2356 ViewportSelection output;
2357 host_impl().active_tree()->GetViewportSelection(&output); 2357 host_impl().active_tree()->GetViewportSelection(&output);
2358 2358
2359 // edge_bottom and edge_top aren't allowed to have NaNs, so the selection 2359 ViewportSelectionBound expected_start;
2360 // should be empty. 2360 ViewportSelectionBound expected_end;
2361 EXPECT_EQ(ViewportSelectionBound(), output.start); 2361
2362 EXPECT_EQ(ViewportSelectionBound(), output.end); 2362 expected_start.type = SELECTION_BOUND_LEFT;
2363 expected_start.edge_top = gfx::PointF(10, 10);
2364 expected_start.edge_bottom = gfx::PointF(10, 20);
2365 expected_start.visible = true;
2366
2367 expected_end.type = SELECTION_BOUND_RIGHT;
2368 expected_end.edge_top = gfx::PointF(50, 10);
2369 expected_end.edge_bottom = gfx::PointF(50, 30);
2370 expected_end.visible = true;
2371
2372 EXPECT_EQ(expected_start, output.start);
2373 EXPECT_EQ(expected_end, output.end);
ajuma 2016/03/24 15:11:59 I think this might be another case where we have a
2363 } 2374 }
2364 2375
2365 TEST_F(LayerTreeImplTest, NumLayersTestOne) { 2376 TEST_F(LayerTreeImplTest, NumLayersTestOne) {
2366 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2377 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2367 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2378 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2368 EXPECT_EQ(1u, host_impl().active_tree()->NumLayers()); 2379 EXPECT_EQ(1u, host_impl().active_tree()->NumLayers());
2369 } 2380 }
2370 2381
2371 TEST_F(LayerTreeImplTest, NumLayersSmallTree) { 2382 TEST_F(LayerTreeImplTest, NumLayersSmallTree) {
2372 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2383 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2373 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2384 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2374 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2385 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2375 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2386 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2376 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2387 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2377 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2388 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2378 } 2389 }
2379 2390
2380 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { 2391 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) {
2381 host_impl().active_tree()->SetDeviceScaleFactor(1.f); 2392 host_impl().active_tree()->SetDeviceScaleFactor(1.f);
2382 host_impl().active_tree()->UpdateDrawProperties(false); 2393 host_impl().active_tree()->UpdateDrawProperties(false);
2383 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); 2394 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties());
2384 host_impl().active_tree()->SetDeviceScaleFactor(2.f); 2395 host_impl().active_tree()->SetDeviceScaleFactor(2.f);
2385 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); 2396 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties());
2386 } 2397 }
2387 2398
2388 } // namespace 2399 } // namespace
2389 } // namespace cc 2400 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698