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

Unified Diff: cc/input/layer_selection_bound_unittest.cc

Issue 1532973002: Add support for (de)serializing LayerSelectionBound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made operator members 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/BUILD.gn » ('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
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
« no previous file with comments | « cc/input/layer_selection_bound.cc ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698