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

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

Issue 1697483003: Properly scale the coordinate for TouchSelection when use-zoom-for-dsf mode is on. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | cc/trees/layer_tree_impl.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 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 7950 matching lines...) Expand 10 before | Expand all | Expand 10 after
7961 host_impl_->DidDrawAllLayers(frame); 7961 host_impl_->DidDrawAllLayers(frame);
7962 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); 7962 EXPECT_TRUE(host_impl_->SwapBuffers(frame));
7963 7963
7964 const std::vector<ui::LatencyInfo>& metadata_latency_after = 7964 const std::vector<ui::LatencyInfo>& metadata_latency_after =
7965 fake_output_surface->last_sent_frame().metadata.latency_info; 7965 fake_output_surface->last_sent_frame().metadata.latency_info;
7966 EXPECT_EQ(1u, metadata_latency_after.size()); 7966 EXPECT_EQ(1u, metadata_latency_after.size());
7967 EXPECT_TRUE(metadata_latency_after[0].FindLatency( 7967 EXPECT_TRUE(metadata_latency_after[0].FindLatency(
7968 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); 7968 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
7969 } 7969 }
7970 7970
7971 TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) { 7971 class LayerTreeHostImplTestWithPaintedDeviceScaleFactor
7972 : public LayerTreeHostImplTest,
7973 public testing::WithParamInterface<float> {
7974 public:
7975 LayerTreeHostImplTestWithPaintedDeviceScaleFactor() = default;
7976 ~LayerTreeHostImplTestWithPaintedDeviceScaleFactor() override = default;
7977
7978 private:
7979 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTestWithPaintedDeviceScaleFactor);
7980 };
7981
7982 TEST_P(LayerTreeHostImplTestWithPaintedDeviceScaleFactor,
7983 SelectionBoundsPassedToCompositorFrameMetadata) {
7984 float painted_device_scale = GetParam();
7985 host_impl_->active_tree()->set_painted_device_scale_factor(
7986 painted_device_scale);
7987
7972 int root_layer_id = 1; 7988 int root_layer_id = 1;
7973 scoped_ptr<SolidColorLayerImpl> root = 7989 scoped_ptr<SolidColorLayerImpl> root =
7974 SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id); 7990 SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id);
7975 root->SetPosition(gfx::PointF()); 7991 root->SetPosition(gfx::PointF());
7976 root->SetBounds(gfx::Size(10, 10)); 7992 root->SetBounds(gfx::Size(10, 10));
7977 root->SetDrawsContent(true); 7993 root->SetDrawsContent(true);
7978 root->SetForceRenderSurface(true); 7994 root->SetForceRenderSurface(true);
7979 7995
7980 host_impl_->active_tree()->SetRootLayer(std::move(root)); 7996 host_impl_->active_tree()->SetRootLayer(std::move(root));
7981 7997
(...skipping 24 matching lines...) Expand all
8006 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 8022 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
8007 host_impl_->DrawLayers(&frame); 8023 host_impl_->DrawLayers(&frame);
8008 host_impl_->DidDrawAllLayers(frame); 8024 host_impl_->DidDrawAllLayers(frame);
8009 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); 8025 EXPECT_TRUE(host_impl_->SwapBuffers(frame));
8010 8026
8011 // Ensure the selection bounds have propagated to the frame metadata. 8027 // Ensure the selection bounds have propagated to the frame metadata.
8012 const ViewportSelection& selection_after = 8028 const ViewportSelection& selection_after =
8013 fake_output_surface->last_sent_frame().metadata.selection; 8029 fake_output_surface->last_sent_frame().metadata.selection;
8014 EXPECT_EQ(selection.start.type, selection_after.start.type); 8030 EXPECT_EQ(selection.start.type, selection_after.start.type);
8015 EXPECT_EQ(selection.end.type, selection_after.end.type); 8031 EXPECT_EQ(selection.end.type, selection_after.end.type);
8016 EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom); 8032 EXPECT_EQ(gfx::ScalePoint(gfx::PointF(selection_bottom),
danakj 2016/02/25 19:37:22 Does this all mean that there is some input to the
oshima 2016/02/25 21:52:03 This is an output from compositor. Currently, cc/
8017 EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top); 8033 1.f / painted_device_scale),
8034 selection_after.start.edge_bottom);
8035 EXPECT_EQ(
8036 gfx::ScalePoint(gfx::PointF(selection_top), 1.f / painted_device_scale),
8037 selection_after.start.edge_top);
8018 EXPECT_TRUE(selection_after.start.visible); 8038 EXPECT_TRUE(selection_after.start.visible);
8019 EXPECT_TRUE(selection_after.start.visible); 8039 EXPECT_TRUE(selection_after.start.visible);
8020 } 8040 }
8021 8041
8042 INSTANTIATE_TEST_CASE_P(WithPaintedDeviceScaleFactor,
8043 LayerTreeHostImplTestWithPaintedDeviceScaleFactor,
8044 testing::Values(1.0f, 1.5f, 2.0f));
8045
8022 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { 8046 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
8023 public: 8047 public:
8024 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, 8048 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
8025 LayerTreeHostImpl* layer_tree_host_impl, 8049 LayerTreeHostImpl* layer_tree_host_impl,
8026 int* set_needs_commit_count, 8050 int* set_needs_commit_count,
8027 int* set_needs_redraw_count, 8051 int* set_needs_redraw_count,
8028 int* forward_to_main_count) 8052 int* forward_to_main_count)
8029 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), 8053 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl),
8030 set_needs_commit_count_(set_needs_commit_count), 8054 set_needs_commit_count_(set_needs_commit_count),
8031 set_needs_redraw_count_(set_needs_redraw_count), 8055 set_needs_redraw_count_(set_needs_redraw_count),
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
10133 // There should not be any jitter measured till we hit the fixed point hits 10157 // There should not be any jitter measured till we hit the fixed point hits
10134 // threshold. 10158 // threshold.
10135 float expected_jitter = 10159 float expected_jitter =
10136 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 10160 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
10137 EXPECT_EQ(jitter, expected_jitter); 10161 EXPECT_EQ(jitter, expected_jitter);
10138 } 10162 }
10139 } 10163 }
10140 10164
10141 } // namespace 10165 } // namespace
10142 } // namespace cc 10166 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698