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

Unified Diff: cc/layers/layer_proto_converter_unittest.cc

Issue 1581693010: Add support for (de)serializing HeadsUpDisplayLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/layer_proto_converter.cc ('k') | cc/proto/layer.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_proto_converter_unittest.cc
diff --git a/cc/layers/layer_proto_converter_unittest.cc b/cc/layers/layer_proto_converter_unittest.cc
index 3aa74d39d214dd3ad4a2e0c49883eabdb0120cd4..b28c91be6d1b0d94981c54e75e848a584d143d2b 100644
--- a/cc/layers/layer_proto_converter_unittest.cc
+++ b/cc/layers/layer_proto_converter_unittest.cc
@@ -5,6 +5,7 @@
#include "cc/layers/layer_proto_converter.h"
#include "cc/layers/empty_content_layer_client.h"
+#include "cc/layers/heads_up_display_layer.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_settings.h"
#include "cc/layers/picture_layer.h"
@@ -403,5 +404,37 @@ TEST_F(LayerProtoConverterTest, PictureLayerTypeDeserialization) {
EXPECT_EQ(proto::LayerType::PICTURE_LAYER, layer_node.type());
}
+TEST_F(LayerProtoConverterTest, HUDLayerTypeSerialization) {
vmpstr 2016/01/15 23:01:39 nit: I prefer lowercase ud (Hud vs HUD)
nyquist 2016/01/15 23:09:54 Done.
+ // Make sure that PictureLayers serialize to the
+ // proto::LayerType::HEADS_UP_DISPLAY_LAYER type.
+ scoped_refptr<HeadsUpDisplayLayer> layer =
+ HeadsUpDisplayLayer::Create(LayerSettings());
+
+ proto::LayerNode layer_hierarchy;
+ LayerProtoConverter::SerializeLayerHierarchy(layer.get(), &layer_hierarchy);
+ EXPECT_EQ(proto::LayerType::HEADS_UP_DISPLAY_LAYER, layer_hierarchy.type());
+}
+
+TEST_F(LayerProtoConverterTest, HUDLayerTypeDeserialization) {
+ // Make sure that proto::LayerType::HEADS_UP_DISPLAY_LAYER ends up building a
+ // HeadsUpDisplayLayer.
+ scoped_refptr<Layer> old_root = HeadsUpDisplayLayer::Create(LayerSettings());
+ proto::LayerNode root_node;
+ root_node.set_id(old_root->id());
+ root_node.set_type(proto::LayerType::HEADS_UP_DISPLAY_LAYER);
+
+ scoped_refptr<Layer> new_root =
+ LayerProtoConverter::DeserializeLayerHierarchy(old_root, root_node);
+
+ // Validate that the ids are equal.
+ EXPECT_EQ(old_root->id(), new_root->id());
+
+ // Check that the layer type is equal by using the type this layer would
+ // serialize to.
+ proto::LayerNode layer_node;
+ new_root->SetTypeForProtoSerialization(&layer_node);
+ EXPECT_EQ(proto::LayerType::HEADS_UP_DISPLAY_LAYER, layer_node.type());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layers/layer_proto_converter.cc ('k') | cc/proto/layer.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698