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

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

Issue 2765013003: Add iterator for DocumentMarker::MarkerTypes (Closed)
Patch Set: Work around MSVC warning 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/DocumentMarker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f6077a0791a536d407553bfe5cb2e3fc19bc5a2a
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerTest.cpp
@@ -0,0 +1,48 @@
+// 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, MarkerTypeIteratorEmpty) {
+ DocumentMarker::MarkerTypes types(0);
+ EXPECT_TRUE(types.begin() == types.end());
+}
+
+TEST_F(DocumentMarkerTest, MarkerTypeIteratorOne) {
+ DocumentMarker::MarkerTypes types(DocumentMarker::Spelling);
+ ASSERT_TRUE(types.begin() != types.end());
+ auto it = types.begin();
+ EXPECT_EQ(DocumentMarker::Spelling, *it);
+ ++it;
+ EXPECT_TRUE(it == types.end());
+}
+
+TEST_F(DocumentMarkerTest, MarkerTypeIteratorConsecutive) {
+ DocumentMarker::MarkerTypes types(0b11); // Spelling | Grammar
+ ASSERT_TRUE(types.begin() != types.end());
+ auto it = types.begin();
+ EXPECT_EQ(DocumentMarker::Spelling, *it);
+ ++it;
+ EXPECT_EQ(DocumentMarker::Grammar, *it);
+ ++it;
+ EXPECT_TRUE(it == types.end());
+}
+
+TEST_F(DocumentMarkerTest, MarkerTypeIteratorDistributed) {
+ DocumentMarker::MarkerTypes types(0b101); // Spelling | TextMatch
+ ASSERT_TRUE(types.begin() != types.end());
+ auto it = types.begin();
+ EXPECT_EQ(DocumentMarker::Spelling, *it);
+ ++it;
+ EXPECT_EQ(DocumentMarker::TextMatch, *it);
+ ++it;
+ EXPECT_TRUE(it == types.end());
+}
+}
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/DocumentMarker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698