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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..53f3ac1b8bd434abda5fa94ac0990a07acb80785 |
--- /dev/null |
+++ b/cc/input/layer_selection_bound_unittest.cc |
@@ -0,0 +1,38 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "cc/input/layer_selection_bound.h" |
+ |
+#include "cc/proto/layer_selection_bound.pb.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+#include "ui/gfx/geometry/point.h" |
+ |
+namespace cc { |
+namespace { |
+ |
+void VerifySerializeAndDeserializeProto(const LayerSelectionBound& bound1) { |
+ proto::LayerSelectionBound proto; |
+ bound1.ToProtobuf(&proto); |
+ LayerSelectionBound bound2; |
+ bound2.FromProtobuf(proto); |
+ EXPECT_EQ(bound1, bound2); |
+} |
+ |
+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); |
+ bound.type = SelectionBoundType::SELECTION_BOUND_CENTER; |
+ VerifySerializeAndDeserializeProto(bound); |
+ bound.type = SelectionBoundType::SELECTION_BOUND_EMPTY; |
+ VerifySerializeAndDeserializeProto(bound); |
+} |
+ |
+} // namespace |
+} // namespace cc |