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

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

Issue 2765013003: Add iterator for DocumentMarker::MarkerTypes (Closed)
Patch Set: 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
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, MarkerTypesIterator) {
14 for (unsigned i = 0; i < (1 << DocumentMarker::MarkerTypeIndexesCount); ++i) {
15 DocumentMarker::MarkerTypes markerTypes(i);
16 Vector<DocumentMarker::MarkerType> typesFromIterator;
17
18 for (DocumentMarker::MarkerType type : markerTypes) {
Xiaocheng 2017/03/22 01:02:58 nit: unnecessary braces.
19 typesFromIterator.push_back(type);
20 }
21
22 for (int i = 0; i < DocumentMarker::MarkerTypeIndexesCount; ++i) {
Xiaocheng 2017/03/22 01:47:12 s/int/unsigned/, and use another variable name.
23 DocumentMarker::MarkerType type =
24 static_cast<DocumentMarker::MarkerType>(1 << i);
25 ASSERT_EQ(markerTypes.contains(type), typesFromIterator.contains(type));
Xiaocheng 2017/03/22 01:02:58 I'm confused... yosin@: Is there any preference b
rlanday 2017/03/22 01:38:25 This checks that for each possible combination of
Xiaocheng 2017/03/22 01:47:12 Makes sense to use ASSERT_EQ here. To make the te
26 }
27 }
28 }
29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698