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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/editing/markers/DocumentMarker.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace blink {
10
11 class DocumentMarkerTest : public ::testing::Test {};
12
13 TEST_F(DocumentMarkerTest, MarkerTypeIteratorEmpty) {
14 DocumentMarker::MarkerTypes types(0);
15 EXPECT_TRUE(types.begin() == types.end());
16 }
17
18 TEST_F(DocumentMarkerTest, MarkerTypeIteratorOne) {
19 DocumentMarker::MarkerTypes types(DocumentMarker::Spelling);
20 ASSERT_TRUE(types.begin() != types.end());
21 auto it = types.begin();
22 EXPECT_EQ(DocumentMarker::Spelling, *it);
23 ++it;
24 EXPECT_TRUE(it == types.end());
25 }
26
27 TEST_F(DocumentMarkerTest, MarkerTypeIteratorConsecutive) {
28 DocumentMarker::MarkerTypes types(0b11); // Spelling | Grammar
29 ASSERT_TRUE(types.begin() != types.end());
30 auto it = types.begin();
31 EXPECT_EQ(DocumentMarker::Spelling, *it);
32 ++it;
33 EXPECT_EQ(DocumentMarker::Grammar, *it);
34 ++it;
35 EXPECT_TRUE(it == types.end());
36 }
37
38 TEST_F(DocumentMarkerTest, MarkerTypeIteratorDistributed) {
39 DocumentMarker::MarkerTypes types(0b101); // Spelling | TextMatch
40 ASSERT_TRUE(types.begin() != types.end());
41 auto it = types.begin();
42 EXPECT_EQ(DocumentMarker::Spelling, *it);
43 ++it;
44 EXPECT_EQ(DocumentMarker::TextMatch, *it);
45 ++it;
46 EXPECT_TRUE(it == types.end());
47 }
48 }
OLDNEW
« 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