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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp

Issue 2765013003: Add iterator for DocumentMarker::MarkerTypes (Closed)
Patch Set: Make requested changes Created 3 years, 9 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
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;
+ }
+ }
+}
+}

Powered by Google App Engine
This is Rietveld 408576698