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

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

Issue 2254623002: [compositor-worker] Create property tree nodes for proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to appease MSVC. Created 4 years, 4 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
« no previous file with comments | « cc/animation/mutable_properties.h ('k') | cc/trees/property_tree_builder.cc » ('j') | 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 "base/macros.h"
8 #include "cc/animation/mutable_properties.h"
7 #include "cc/layers/heads_up_display_layer_impl.h" 9 #include "cc/layers/heads_up_display_layer_impl.h"
8 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
9 #include "cc/test/geometry_test_utils.h" 11 #include "cc/test/geometry_test_utils.h"
10 #include "cc/test/layer_test_common.h" 12 #include "cc/test/layer_test_common.h"
11 #include "cc/test/layer_tree_settings_for_testing.h" 13 #include "cc/test/layer_tree_settings_for_testing.h"
12 #include "cc/trees/clip_node.h" 14 #include "cc/trees/clip_node.h"
13 #include "cc/trees/draw_property_utils.h" 15 #include "cc/trees/draw_property_utils.h"
14 #include "cc/trees/layer_tree_host_common.h" 16 #include "cc/trees/layer_tree_host_common.h"
15 #include "cc/trees/layer_tree_host_impl.h" 17 #include "cc/trees/layer_tree_host_impl.h"
16 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 EXPECT_FALSE(output.start.visible()); 2011 EXPECT_FALSE(output.start.visible());
2010 2012
2011 // If the handle bottom is partially visible, the handle is marked visible. 2013 // If the handle bottom is partially visible, the handle is marked visible.
2012 input.start.edge_top = gfx::Point(0, -20); 2014 input.start.edge_top = gfx::Point(0, -20);
2013 input.start.edge_bottom = gfx::Point(0, 1); 2015 input.start.edge_bottom = gfx::Point(0, 1);
2014 host_impl().active_tree()->RegisterSelection(input); 2016 host_impl().active_tree()->RegisterSelection(input);
2015 host_impl().active_tree()->GetViewportSelection(&output); 2017 host_impl().active_tree()->GetViewportSelection(&output);
2016 EXPECT_TRUE(output.start.visible()); 2018 EXPECT_TRUE(output.start.visible());
2017 } 2019 }
2018 2020
2021 TEST_F(LayerTreeImplTest, NodesiesForProxies) {
2022 LayerImpl* root = root_layer();
2023 root->SetDrawsContent(true);
2024 root->SetBounds(gfx::Size(100, 100));
2025
2026 uint32_t properties[] = {
2027 MutableProperty::kOpacity, MutableProperty::kScrollLeft,
2028 MutableProperty::kScrollTop, MutableProperty::kTransform,
2029 };
2030
2031 for (size_t i = 0; i < arraysize(properties); ++i) {
2032 int sub_layer_id = i + 2;
2033 std::unique_ptr<LayerImpl> sub_layer =
2034 LayerImpl::Create(host_impl().active_tree(), sub_layer_id);
2035 sub_layer->SetBounds(gfx::Size(50, 50));
2036 sub_layer->SetDrawsContent(true);
2037 sub_layer->SetMutableProperties(properties[i]);
2038 root->test_properties()->AddChild(std::move(sub_layer));
2039 }
2040
2041 host_impl().active_tree()->BuildPropertyTreesForTesting();
2042
2043 for (size_t i = 0; i < arraysize(properties); ++i) {
2044 LayerImpl* layer = host_impl().active_tree()->LayerById(i + 2);
2045 switch (properties[i]) {
2046 case MutableProperty::kOpacity:
2047 DCHECK_EQ(root->transform_tree_index(), layer->transform_tree_index());
2048 DCHECK_NE(root->effect_tree_index(), layer->effect_tree_index());
2049 break;
2050 case MutableProperty::kScrollLeft:
2051 case MutableProperty::kScrollTop:
2052 case MutableProperty::kTransform:
2053 DCHECK_EQ(root->effect_tree_index(), layer->effect_tree_index());
2054 DCHECK_NE(root->transform_tree_index(), layer->transform_tree_index());
2055 for (size_t j = 0; j < arraysize(properties); ++j) {
2056 if (j == i)
2057 continue;
2058 LayerImpl* other = host_impl().active_tree()->LayerById(j + 2);
2059 DCHECK_NE(other->transform_tree_index(),
2060 layer->transform_tree_index());
2061 }
2062 break;
2063 }
2064 }
2065 }
2066
2019 TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) { 2067 TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
2020 LayerImpl* root = root_layer(); 2068 LayerImpl* root = root_layer();
2021 root->SetDrawsContent(true); 2069 root->SetDrawsContent(true);
2022 root->SetBounds(gfx::Size(100, 100)); 2070 root->SetBounds(gfx::Size(100, 100));
2023 2071
2024 int root_layer_id = root->id(); 2072 int root_layer_id = root->id();
2025 int sub_layer_id = 2; 2073 int sub_layer_id = 2;
2026 2074
2027 gfx::Vector2dF sub_layer_offset(10, 0); 2075 gfx::Vector2dF sub_layer_offset(10, 0);
2028 { 2076 {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 auto weak_promise = promise->AsWeakPtr(); 2370 auto weak_promise = promise->AsWeakPtr();
2323 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); 2371 host_impl().active_tree()->QueueSwapPromise(std::move(promise));
2324 host_impl().active_tree()->BreakSwapPromises( 2372 host_impl().active_tree()->BreakSwapPromises(
2325 SwapPromise::DidNotSwapReason::SWAP_FAILS); 2373 SwapPromise::DidNotSwapReason::SWAP_FAILS);
2326 EXPECT_FALSE(weak_promise); 2374 EXPECT_FALSE(weak_promise);
2327 } 2375 }
2328 } 2376 }
2329 2377
2330 } // namespace 2378 } // namespace
2331 } // namespace cc 2379 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/mutable_properties.h ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698