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

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

Issue 2030033003: Replace cc::ViewportSelectionBound with gfx::SelectionBound (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android build compiles locally Created 4 years, 6 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 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 8252 matching lines...) Expand 10 before | Expand all | Expand 10 after
8263 root->SetPosition(gfx::PointF()); 8263 root->SetPosition(gfx::PointF());
8264 root->SetBounds(gfx::Size(10, 10)); 8264 root->SetBounds(gfx::Size(10, 10));
8265 root->SetDrawsContent(true); 8265 root->SetDrawsContent(true);
8266 root->test_properties()->force_render_surface = true; 8266 root->test_properties()->force_render_surface = true;
8267 8267
8268 host_impl_->active_tree()->SetRootLayer(std::move(root)); 8268 host_impl_->active_tree()->SetRootLayer(std::move(root));
8269 8269
8270 // Ensure the default frame selection bounds are empty. 8270 // Ensure the default frame selection bounds are empty.
8271 FakeOutputSurface* fake_output_surface = 8271 FakeOutputSurface* fake_output_surface =
8272 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); 8272 static_cast<FakeOutputSurface*>(host_impl_->output_surface());
8273 const ViewportSelection& selection_before = 8273 const Selection<gfx::SelectionBound>& selection_before =
8274 fake_output_surface->last_sent_frame().metadata.selection; 8274 fake_output_surface->last_sent_frame().metadata.selection;
8275 EXPECT_EQ(ViewportSelectionBound(), selection_before.start); 8275 EXPECT_EQ(gfx::SelectionBound(), selection_before.start);
8276 EXPECT_EQ(ViewportSelectionBound(), selection_before.end); 8276 EXPECT_EQ(gfx::SelectionBound(), selection_before.end);
8277 8277
8278 // Plumb the layer-local selection bounds. 8278 // Plumb the layer-local selection bounds.
8279 gfx::Point selection_top(5, 0); 8279 gfx::Point selection_top(5, 0);
8280 gfx::Point selection_bottom(5, 5); 8280 gfx::Point selection_bottom(5, 5);
8281 LayerSelection selection; 8281 LayerSelection selection;
8282 selection.start.type = SELECTION_BOUND_CENTER; 8282 selection.start.type = gfx::SelectionBound::CENTER;
8283 selection.start.layer_id = root_layer_id; 8283 selection.start.layer_id = root_layer_id;
8284 selection.start.edge_bottom = selection_bottom; 8284 selection.start.edge_bottom = selection_bottom;
8285 selection.start.edge_top = selection_top; 8285 selection.start.edge_top = selection_top;
8286 selection.end = selection.start; 8286 selection.end = selection.start;
8287 host_impl_->active_tree()->RegisterSelection(selection); 8287 host_impl_->active_tree()->RegisterSelection(selection);
8288 8288
8289 // Trigger a draw-swap sequence. 8289 // Trigger a draw-swap sequence.
8290 host_impl_->SetNeedsRedraw(); 8290 host_impl_->SetNeedsRedraw();
8291 8291
8292 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); 8292 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
8293 LayerTreeHostImpl::FrameData frame; 8293 LayerTreeHostImpl::FrameData frame;
8294 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 8294 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
8295 host_impl_->DrawLayers(&frame); 8295 host_impl_->DrawLayers(&frame);
8296 host_impl_->DidDrawAllLayers(frame); 8296 host_impl_->DidDrawAllLayers(frame);
8297 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); 8297 EXPECT_TRUE(host_impl_->SwapBuffers(frame));
8298 8298
8299 // Ensure the selection bounds have propagated to the frame metadata. 8299 // Ensure the selection bounds have propagated to the frame metadata.
8300 const ViewportSelection& selection_after = 8300 const Selection<gfx::SelectionBound>& selection_after =
8301 fake_output_surface->last_sent_frame().metadata.selection; 8301 fake_output_surface->last_sent_frame().metadata.selection;
8302 EXPECT_EQ(selection.start.type, selection_after.start.type); 8302 EXPECT_EQ(selection.start.type, selection_after.start.type());
8303 EXPECT_EQ(selection.end.type, selection_after.end.type); 8303 EXPECT_EQ(selection.end.type, selection_after.end.type());
8304 EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom); 8304 EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom());
8305 EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top); 8305 EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top());
8306 EXPECT_TRUE(selection_after.start.visible); 8306 EXPECT_TRUE(selection_after.start.visible());
8307 EXPECT_TRUE(selection_after.start.visible); 8307 EXPECT_TRUE(selection_after.start.visible());
8308 } 8308 }
8309 8309
8310 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { 8310 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
8311 public: 8311 public:
8312 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, 8312 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
8313 LayerTreeHostImpl* layer_tree_host_impl, 8313 LayerTreeHostImpl* layer_tree_host_impl,
8314 int* set_needs_commit_count, 8314 int* set_needs_commit_count,
8315 int* set_needs_redraw_count, 8315 int* set_needs_redraw_count,
8316 int* forward_to_main_count) 8316 int* forward_to_main_count)
8317 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), 8317 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl),
(...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after
10759 10759
10760 // Re-initialize with a software output surface. 10760 // Re-initialize with a software output surface.
10761 output_surface_ = FakeOutputSurface::CreateSoftware( 10761 output_surface_ = FakeOutputSurface::CreateSoftware(
10762 base::WrapUnique(new SoftwareOutputDevice)); 10762 base::WrapUnique(new SoftwareOutputDevice));
10763 host_impl_->InitializeRenderer(output_surface_.get()); 10763 host_impl_->InitializeRenderer(output_surface_.get());
10764 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10764 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10765 } 10765 }
10766 10766
10767 } // namespace 10767 } // namespace
10768 } // namespace cc 10768 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698