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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 14630239844e4b9f71efaac400da93aa5de1fd74..175244d66963085033a7a30dd7c7040b8d39afa8 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -7968,7 +7968,23 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
}
-TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
+class LayerTreeHostImplTestWithPaintedDeviceScaleFactor
+ : public LayerTreeHostImplTest,
+ public testing::WithParamInterface<float> {
+ public:
+ LayerTreeHostImplTestWithPaintedDeviceScaleFactor() = default;
+ ~LayerTreeHostImplTestWithPaintedDeviceScaleFactor() override = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTestWithPaintedDeviceScaleFactor);
+};
+
+TEST_P(LayerTreeHostImplTestWithPaintedDeviceScaleFactor,
+ SelectionBoundsPassedToCompositorFrameMetadata) {
+ float painted_device_scale = GetParam();
+ host_impl_->active_tree()->set_painted_device_scale_factor(
+ painted_device_scale);
+
int root_layer_id = 1;
scoped_ptr<SolidColorLayerImpl> root =
SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id);
@@ -8013,12 +8029,20 @@ TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
fake_output_surface->last_sent_frame().metadata.selection;
EXPECT_EQ(selection.start.type, selection_after.start.type);
EXPECT_EQ(selection.end.type, selection_after.end.type);
- EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom);
- EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top);
+ 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/
+ 1.f / painted_device_scale),
+ selection_after.start.edge_bottom);
+ EXPECT_EQ(
+ gfx::ScalePoint(gfx::PointF(selection_top), 1.f / painted_device_scale),
+ selection_after.start.edge_top);
EXPECT_TRUE(selection_after.start.visible);
EXPECT_TRUE(selection_after.start.visible);
}
+INSTANTIATE_TEST_CASE_P(WithPaintedDeviceScaleFactor,
+ LayerTreeHostImplTestWithPaintedDeviceScaleFactor,
+ testing::Values(1.0f, 1.5f, 2.0f));
+
class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
public:
SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
« 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