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

Unified Diff: cc/input/layer_selection_bound_unittest.cc

Issue 1531413002: Add support for (de)serializing LayerSelection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serialize-layer-selection-bound
Patch Set: Addressed nits from vmpstr Created 5 years 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/input/layer_selection_bound.cc ('k') | cc/proto/layer_selection_bound.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/input/layer_selection_bound_unittest.cc
diff --git a/cc/input/layer_selection_bound_unittest.cc b/cc/input/layer_selection_bound_unittest.cc
index 53f3ac1b8bd434abda5fa94ac0990a07acb80785..e1ad56b53b8de39b2279760fc07e3d13d02779fe 100644
--- a/cc/input/layer_selection_bound_unittest.cc
+++ b/cc/input/layer_selection_bound_unittest.cc
@@ -19,12 +19,22 @@ void VerifySerializeAndDeserializeProto(const LayerSelectionBound& bound1) {
EXPECT_EQ(bound1, bound2);
}
+void VerifySerializeAndDeserializeLayerSelectionProto(
+ const LayerSelection& selection1) {
+ proto::LayerSelection proto;
+ LayerSelectionToProtobuf(selection1, &proto);
+ LayerSelection selection2;
+ LayerSelectionFromProtobuf(&selection2, proto);
+ EXPECT_EQ(selection1, selection2);
+}
+
TEST(LayerSelectionBoundTest, AllTypePermutations) {
LayerSelectionBound bound;
bound.type = SelectionBoundType::SELECTION_BOUND_LEFT;
bound.edge_top = gfx::Point(3, 14);
bound.edge_bottom = gfx::Point(6, 28);
bound.layer_id = 42;
+
VerifySerializeAndDeserializeProto(bound);
bound.type = SelectionBoundType::SELECTION_BOUND_RIGHT;
VerifySerializeAndDeserializeProto(bound);
@@ -34,5 +44,33 @@ TEST(LayerSelectionBoundTest, AllTypePermutations) {
VerifySerializeAndDeserializeProto(bound);
}
+TEST(LayerSelectionTest, AllSelectionPermutations) {
+ LayerSelectionBound start;
+ start.type = SelectionBoundType::SELECTION_BOUND_LEFT;
+ start.edge_top = gfx::Point(3, 14);
+ start.edge_bottom = gfx::Point(6, 28);
+ start.layer_id = 42;
+
+ LayerSelectionBound end;
+ end.type = SelectionBoundType::SELECTION_BOUND_RIGHT;
+ end.edge_top = gfx::Point(14, 3);
+ end.edge_bottom = gfx::Point(28, 6);
+ end.layer_id = 24;
+
+ LayerSelection selection;
+ selection.start = start;
+ selection.end = end;
+ selection.is_editable = true;
+ selection.is_empty_text_form_control = true;
+
+ VerifySerializeAndDeserializeLayerSelectionProto(selection);
+ selection.is_empty_text_form_control = false;
+ VerifySerializeAndDeserializeLayerSelectionProto(selection);
+ selection.is_editable = false;
+ VerifySerializeAndDeserializeLayerSelectionProto(selection);
+ selection.is_empty_text_form_control = true;
+ VerifySerializeAndDeserializeLayerSelectionProto(selection);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/input/layer_selection_bound.cc ('k') | cc/proto/layer_selection_bound.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698