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

Unified Diff: cc/trees/layer_tree_host_unittest_serialization.cc

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use friend class for test code, or we need hundreds of SetSomethingForTest functions in future refa… Created 4 years, 5 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
Index: cc/trees/layer_tree_host_unittest_serialization.cc
diff --git a/cc/trees/layer_tree_host_unittest_serialization.cc b/cc/trees/layer_tree_host_unittest_serialization.cc
index 1cc36bd0a6cfe6bff2f6130eab35bb07d275a659..816b1157156ab2e87e33966e7124aca75ffad363 100644
--- a/cc/trees/layer_tree_host_unittest_serialization.cc
+++ b/cc/trees/layer_tree_host_unittest_serialization.cc
@@ -20,6 +20,7 @@
#include "cc/test/layer_tree_test.h"
#include "cc/test/skia_common.h"
#include "cc/test/test_task_graph_runner.h"
+#include "cc/trees/layer_tree.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -82,8 +83,9 @@ class LayerTreeHostSerializationTest : public testing::Test {
void TearDown() override {
// Need to reset |in_paint_layer_contents_| to tear down.
- layer_tree_host_src_->in_paint_layer_contents_ = false;
- layer_tree_host_dst_->in_paint_layer_contents_ = false;
+
+ layer_tree_host_src_->GetLayerTree()->in_paint_layer_contents_ = false;
+ layer_tree_host_dst_->GetLayerTree()->in_paint_layer_contents_ = false;
// Need to reset LayerTreeHost pointers before tear down.
layer_tree_host_src_ = nullptr;
@@ -100,9 +102,11 @@ class LayerTreeHostSerializationTest : public testing::Test {
void VerifySerializationAndDeserialization() {
proto::LayerTreeHost proto;
+ LayerTree* layer_tree_src = layer_tree_host_src_->GetLayerTree();
+ LayerTree* layer_tree_dst = layer_tree_host_dst_->GetLayerTree();
std::unordered_set<Layer*> layers_that_should_push_properties_src =
- layer_tree_host_src_->LayersThatShouldPushProperties();
+ layer_tree_src->LayersThatShouldPushProperties();
std::vector<std::unique_ptr<SwapPromise>> swap_promises;
layer_tree_host_src_->ToProtobufForCommit(&proto, &swap_promises);
layer_tree_host_dst_->FromProtobufForCommit(proto);
@@ -150,14 +154,14 @@ class LayerTreeHostSerializationTest : public testing::Test {
layer_tree_host_dst_->background_color_);
EXPECT_EQ(layer_tree_host_src_->has_transparent_background_,
layer_tree_host_dst_->has_transparent_background_);
- EXPECT_EQ(layer_tree_host_src_->in_paint_layer_contents_,
- layer_tree_host_dst_->in_paint_layer_contents_);
+ EXPECT_EQ(layer_tree_src->in_paint_layer_contents(),
+ layer_tree_dst->in_paint_layer_contents());
EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_);
EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_,
layer_tree_host_dst_->next_commit_forces_redraw_);
for (auto* layer : layers_that_should_push_properties_src) {
- EXPECT_TRUE(layer_tree_host_dst_->LayerNeedsPushPropertiesForTesting(
- layer_tree_host_dst_->LayerById(layer->id())));
+ EXPECT_TRUE(layer_tree_dst->LayerNeedsPushPropertiesForTesting(
+ layer_tree_dst->LayerById(layer->id())));
}
if (layer_tree_host_src_->hud_layer_) {
@@ -282,8 +286,9 @@ class LayerTreeHostSerializationTest : public testing::Test {
// Set in_paint_layer_contents_ only after all calls to AddChild() have
// finished to ensure it's allowed to do so at that time.
- layer_tree_host_src_->in_paint_layer_contents_ =
- !layer_tree_host_src_->in_paint_layer_contents_;
+ LayerTree* layer_tree_src = layer_tree_host_src_->GetLayerTree();
+ layer_tree_src->in_paint_layer_contents_ =
+ !layer_tree_src->in_paint_layer_contents();
LayerSelectionBound sel_bound;
sel_bound.edge_top = gfx::Point(14, 3);

Powered by Google App Engine
This is Rietveld 408576698