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

Unified Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 1783613004: CC Animation: Erase cc::LayerSettings everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseandroid
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_unittest.cc ('k') | cc/layers/solid_color_layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/scrollbar_layer_unittest.cc
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index a592c50998a9330934e3c7cc5b4bb99264fc0ebc..7288882f5b6c6e7f19d255ac63b876b48613ca4e 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -37,24 +37,22 @@
namespace cc {
namespace {
-LayerImpl* LayerImplForScrollAreaAndScrollbar(const LayerSettings& settings,
- FakeLayerTreeHost* host,
+LayerImpl* LayerImplForScrollAreaAndScrollbar(FakeLayerTreeHost* host,
scoped_ptr<Scrollbar> scrollbar,
bool reverse_order,
bool use_solid_color_scrollbar,
int thumb_thickness,
int track_start) {
- scoped_refptr<Layer> layer_tree_root = Layer::Create(settings);
- scoped_refptr<Layer> child1 = Layer::Create(settings);
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> child1 = Layer::Create();
scoped_refptr<Layer> child2;
if (use_solid_color_scrollbar) {
const bool kIsLeftSideVerticalScrollbar = false;
child2 = SolidColorScrollbarLayer::Create(
- settings, scrollbar->Orientation(), thumb_thickness, track_start,
+ scrollbar->Orientation(), thumb_thickness, track_start,
kIsLeftSideVerticalScrollbar, child1->id());
} else {
- child2 = PaintedScrollbarLayer::Create(settings, std::move(scrollbar),
- child1->id());
+ child2 = PaintedScrollbarLayer::Create(std::move(scrollbar), child1->id());
}
layer_tree_root->AddChild(child1);
layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1);
@@ -139,13 +137,10 @@ class ScrollbarLayerTest : public testing::Test {
EXPECT_FALSE(layer_tree_host_->output_surface_lost());
}
- const LayerSettings& layer_settings() { return layer_settings_; }
-
protected:
FakeLayerTreeHostClient fake_client_;
TestTaskGraphRunner task_graph_runner_;
LayerTreeSettings layer_tree_settings_;
- LayerSettings layer_settings_;
scoped_ptr<FakeResourceTrackingLayerTreeHost> layer_tree_host_;
};
@@ -153,8 +148,7 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) {
// Create and attach a non-overlay scrollbar.
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar(
- layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false,
- false, 0, 0);
+ layer_tree_host_.get(), std::move(scrollbar), false, false, 0, 0);
PaintedScrollbarLayerImpl* scrollbar_layer_impl =
static_cast<PaintedScrollbarLayerImpl*>(
layer_impl_tree_root->children()[1].get());
@@ -177,8 +171,7 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) {
scrollbar.reset(new FakeScrollbar(false, false, true));
layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar(
- layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false,
- false, 0, 0);
+ layer_tree_host_.get(), std::move(scrollbar), false, false, 0, 0);
scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>(
layer_impl_tree_root->children()[1].get());
layer_impl_tree_root->layer_tree_impl()->BuildPropertyTreesForTesting();
@@ -197,11 +190,11 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) {
TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
- scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
- scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings());
- scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> scroll_layer = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<Layer> scrollbar_layer = PaintedScrollbarLayer::Create(
- layer_settings(), std::move(scrollbar), layer_tree_root->id());
+ std::move(scrollbar), layer_tree_root->id());
// Choose bounds to give max_scroll_offset = (30, 50).
layer_tree_root->SetBounds(gfx::Size(70, 150));
@@ -265,12 +258,11 @@ TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
} while (false)
TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
- scoped_refptr<Layer> root_clip_layer = Layer::Create(layer_settings());
- scoped_refptr<Layer> root_layer = Layer::Create(layer_settings());
- scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> root_clip_layer = Layer::Create();
+ scoped_refptr<Layer> root_layer = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(layer_settings(), false, true,
- root_layer->id());
+ FakePaintedScrollbarLayer::Create(false, true, root_layer->id());
root_layer->SetScrollClipLayerId(root_clip_layer->id());
// Give the root-clip a size that will result in MaxScrollOffset = (80, 0).
@@ -306,12 +298,11 @@ TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
}
TEST_F(ScrollbarLayerTest, ThumbRect) {
- scoped_refptr<Layer> root_clip_layer = Layer::Create(layer_settings());
- scoped_refptr<Layer> root_layer = Layer::Create(layer_settings());
- scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> root_clip_layer = Layer::Create();
+ scoped_refptr<Layer> root_layer = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(layer_settings(), false, true,
- root_layer->id());
+ FakePaintedScrollbarLayer::Create(false, true, root_layer->id());
root_layer->SetScrollClipLayerId(root_clip_layer->id());
// Give the root-clip a size that will result in MaxScrollOffset = (80, 0).
@@ -391,8 +382,8 @@ TEST_F(ScrollbarLayerTest, SolidColorDrawQuads) {
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true));
LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar(
- layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false,
- true, kThumbThickness, kTrackStart);
+ layer_tree_host_.get(), std::move(scrollbar), false, true,
+ kThumbThickness, kTrackStart);
ScrollbarLayerImplBase* scrollbar_layer_impl =
static_cast<SolidColorScrollbarLayerImpl*>(
layer_impl_tree_root->children()[1].get());
@@ -452,15 +443,15 @@ TEST_F(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true));
{
- scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
- scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> scroll_layer = Layer::Create();
scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
- scoped_refptr<Layer> child1 = Layer::Create(layer_settings());
+ scoped_refptr<Layer> child1 = Layer::Create();
scoped_refptr<Layer> child2;
const bool kIsLeftSideVerticalScrollbar = false;
child2 = SolidColorScrollbarLayer::Create(
- layer_settings(), scrollbar->Orientation(), kThumbThickness,
- kTrackStart, kIsLeftSideVerticalScrollbar, child1->id());
+ scrollbar->Orientation(), kThumbThickness, kTrackStart,
+ kIsLeftSideVerticalScrollbar, child1->id());
child2->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
scroll_layer->AddChild(child1);
scroll_layer->InsertChild(child2, 1);
@@ -612,12 +603,12 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest {
void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; }
void BeginTest() override {
- scroll_layer_ = Layer::Create(layer_settings());
+ scroll_layer_ = Layer::Create();
layer_tree_host()->root_layer()->AddChild(scroll_layer_);
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
- scrollbar_layer_ = PaintedScrollbarLayer::Create(
- layer_settings(), std::move(scrollbar), scroll_layer_->id());
+ scrollbar_layer_ = PaintedScrollbarLayer::Create(std::move(scrollbar),
+ scroll_layer_->id());
scrollbar_layer_->SetScrollLayer(scroll_layer_->id());
scrollbar_layer_->SetLayerTreeHost(layer_tree_host());
scrollbar_layer_->SetBounds(bounds_);
@@ -676,19 +667,19 @@ class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest {
int expected_deleted,
bool use_solid_color_scrollbar) {
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false));
- scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
- scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<Layer> scrollbar_layer;
if (use_solid_color_scrollbar) {
const int kThumbThickness = 3;
const int kTrackStart = 0;
const bool kIsLeftSideVerticalScrollbar = false;
scrollbar_layer = SolidColorScrollbarLayer::Create(
- layer_settings(), scrollbar->Orientation(), kThumbThickness,
- kTrackStart, kIsLeftSideVerticalScrollbar, layer_tree_root->id());
+ scrollbar->Orientation(), kThumbThickness, kTrackStart,
+ kIsLeftSideVerticalScrollbar, layer_tree_root->id());
} else {
- scrollbar_layer = PaintedScrollbarLayer::Create(
- layer_settings(), std::move(scrollbar), layer_tree_root->id());
+ scrollbar_layer = PaintedScrollbarLayer::Create(std::move(scrollbar),
+ layer_tree_root->id());
}
layer_tree_root->AddChild(content_layer);
layer_tree_root->AddChild(scrollbar_layer);
@@ -741,11 +732,10 @@ TEST_F(ScrollbarLayerTestResourceCreationAndRelease,
TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TestResourceUpdate) {
gfx::Point scrollbar_location(0, 185);
- scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
- scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(layer_settings(), false, true,
- layer_tree_root->id());
+ FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id());
layer_tree_root->AddChild(content_layer);
layer_tree_root->AddChild(scrollbar_layer);
@@ -884,11 +874,10 @@ class ScaledScrollbarLayerTestResourceCreation : public ScrollbarLayerTest {
public:
void TestResourceUpload(const float test_scale) {
gfx::Point scrollbar_location(0, 185);
- scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
- scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(layer_settings(), false, true,
- layer_tree_root->id());
+ FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id());
layer_tree_root->AddChild(content_layer);
layer_tree_root->AddChild(scrollbar_layer);
@@ -956,10 +945,10 @@ class ScaledScrollbarLayerTestScaledRasterization : public ScrollbarLayerTest {
void TestScale(const gfx::Rect scrollbar_rect, const float test_scale) {
bool paint_during_update = true;
bool has_thumb = false;
- scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(layer_settings(), paint_during_update,
- has_thumb, layer_tree_root->id());
+ FakePaintedScrollbarLayer::Create(paint_during_update, has_thumb,
+ layer_tree_root->id());
layer_tree_root->AddChild(scrollbar_layer);
« no previous file with comments | « cc/layers/picture_layer_unittest.cc ('k') | cc/layers/solid_color_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698