Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp |
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4df3c308c6ccb67edcd366488cb17343e85b60d8 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp |
@@ -0,0 +1,35 @@ |
+// Copyright 2017 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 "core/editing/markers/DocumentMarker.h" |
+ |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace blink { |
+ |
+class DocumentMarkerTest : public ::testing::Test {}; |
+ |
+TEST_F(DocumentMarkerTest, MarkerTypesIterator) { |
yosin_UTC9
2017/03/22 04:06:26
I would like to have explicit test cases rather th
|
+ for (unsigned markerTypesIndex = 0; |
+ markerTypesIndex < (1 << DocumentMarker::MarkerTypeIndexesCount); |
+ ++markerTypesIndex) { |
+ DocumentMarker::MarkerTypes markerTypes(markerTypesIndex); |
+ Vector<DocumentMarker::MarkerType> typesFromIterator; |
+ |
+ for (DocumentMarker::MarkerType type : markerTypes) |
+ typesFromIterator.push_back(type); |
+ |
+ for (int markerTypeIndex = 0; |
+ markerTypeIndex < DocumentMarker::MarkerTypeIndexesCount; |
+ ++markerTypeIndex) { |
+ DocumentMarker::MarkerType type = |
+ static_cast<DocumentMarker::MarkerType>(1 << markerTypeIndex); |
+ ASSERT_EQ(markerTypes.contains(type), typesFromIterator.contains(type)) |
+ << "MarkerTypeIterator returned wrong result for MarkerType " |
+ << (1 << markerTypeIndex) << " in MarkerTypes with mask " |
+ << markerTypesIndex; |
+ } |
+ } |
+} |
+} |