[go: nahoru, domu]

Refactor cc unittests in layer list mode

When in layer list mode:

- Initialize root properties in LayerTreeTest::SetupTree()
- Provide LayerTreeTest::SetupViewport() (previously global function
  CreateVirtualViewportLayers in layer_tree_test.h). A test needing
  viewport layers and properties can call it from its SetupTree().
- Tests setup their layers and properties in SetupTree().

property_tree_test_utils.h provides helper functions for convenience
of tests to setup properties in the following way:

  scoped_refptr<Layer> layer = Layer::Create();
  ...
  InheritProperties(layer.get(), parent_layer_for_properties);
  auto& transform_node = CreateTransform(layer.get());
  transform_node.xxx = // customize the transform node
  root_layer->AddChild(layer);

This changes the procedure of pixel tests in layer list mode when
setting up layers and properties. Previously we setup property tree
outside of SetupTree() before BeginTest() when layer_tree_host() was
not created yet, causing many inconveninces. Now we always setup
layers and properties in SetupTree().

Bug: 994361
Change-Id: I2b3c0a47037c685618372bdff389551e09b62634
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761642
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689149}
13 files changed