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

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

Issue 1878473002: ASSERT -> DCHECK in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/VisibleUnits.h" 5 #include "core/editing/VisibleUnits.h"
6 6
7 #include "core/dom/Text.h" 7 #include "core/dom/Text.h"
8 #include "core/editing/EditingTestBase.h" 8 #include "core/editing/EditingTestBase.h"
9 #include "core/editing/VisiblePosition.h" 9 #include "core/editing/VisiblePosition.h"
10 #include "core/html/HTMLTextFormControlElement.h" 10 #include "core/html/HTMLTextFormControlElement.h"
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 // shadow tree. 1248 // shadow tree.
1249 EXPECT_EQ(Position(zero, 0), startOfParagraph(createVisiblePositionInDOMTree (*three, 2)).deepEquivalent()); 1249 EXPECT_EQ(Position(zero, 0), startOfParagraph(createVisiblePositionInDOMTree (*three, 2)).deepEquivalent());
1250 EXPECT_EQ(PositionInFlatTree(three, 0), startOfParagraph(createVisiblePositi onInFlatTree(*three, 2)).deepEquivalent()); 1250 EXPECT_EQ(PositionInFlatTree(three, 0), startOfParagraph(createVisiblePositi onInFlatTree(*three, 2)).deepEquivalent());
1251 1251
1252 // crbug.com/563777. startOfParagraph() unexpectedly returned a null 1252 // crbug.com/563777. startOfParagraph() unexpectedly returned a null
1253 // position with nested editable <BODY>s. 1253 // position with nested editable <BODY>s.
1254 Element* root = document().documentElement(); 1254 Element* root = document().documentElement();
1255 root->setInnerHTML("<style>* { display:inline-table; }</style><body contente ditable=true><svg><svg><foreignObject>abc<svg></svg></foreignObject></svg></svg> </body>", ASSERT_NO_EXCEPTION); 1255 root->setInnerHTML("<style>* { display:inline-table; }</style><body contente ditable=true><svg><svg><foreignObject>abc<svg></svg></foreignObject></svg></svg> </body>", ASSERT_NO_EXCEPTION);
1256 Element* oldBody = document().body(); 1256 Element* oldBody = document().body();
1257 root->setInnerHTML("<body contenteditable=true><svg><foreignObject><style>de f</style>", ASSERT_NO_EXCEPTION); 1257 root->setInnerHTML("<body contenteditable=true><svg><foreignObject><style>de f</style>", ASSERT_NO_EXCEPTION);
1258 ASSERT(oldBody != document().body()); 1258 DCHECK_NE(oldBody, document().body());
1259 Node* foreignObject = document().body()->firstChild()->firstChild(); 1259 Node* foreignObject = document().body()->firstChild()->firstChild();
1260 foreignObject->insertBefore(oldBody, foreignObject->firstChild()); 1260 foreignObject->insertBefore(oldBody, foreignObject->firstChild());
1261 Node* styleText = foreignObject->lastChild()->firstChild(); 1261 Node* styleText = foreignObject->lastChild()->firstChild();
1262 ASSERT(styleText->isTextNode()); 1262 DCHECK(styleText->isTextNode());
yosin_UTC9 2016/04/14 04:35:00 How about adding |<< styleText|?
1263 updateLayoutAndStyleForPainting(); 1263 updateLayoutAndStyleForPainting();
1264 1264
1265 EXPECT_FALSE(startOfParagraph(createVisiblePosition(Position(styleText, 0))) .isNull()); 1265 EXPECT_FALSE(startOfParagraph(createVisiblePosition(Position(styleText, 0))) .isNull());
1266 } 1266 }
1267 1267
1268 TEST_F(VisibleUnitsTest, startOfSentence) 1268 TEST_F(VisibleUnitsTest, startOfSentence)
1269 { 1269 {
1270 const char* bodyContent = "<a id=host><b id=one>1</b><b id=two>22</b></a>"; 1270 const char* bodyContent = "<a id=host><b id=one>1</b><b id=two>22</b></a>";
1271 const char* shadowContent = "<p><i id=three>333</i> <content select=#two></c ontent> <content select=#one></content> <i id=four>4444</i></p>"; 1271 const char* shadowContent = "<p><i id=three>333</i> <content select=#two></c ontent> <content select=#one></content> <i id=four>4444</i></p>";
1272 setBodyContent(bodyContent); 1272 setBodyContent(bodyContent);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 // Repro case of crbug.com/584030 1350 // Repro case of crbug.com/584030
1351 const char* bodyContent = "<button><rt><script>document.designMode = 'on'</s cript></rt></button>"; 1351 const char* bodyContent = "<button><rt><script>document.designMode = 'on'</s cript></rt></button>";
1352 setBodyContent(bodyContent); 1352 setBodyContent(bodyContent);
1353 updateLayoutAndStyleForPainting(); 1353 updateLayoutAndStyleForPainting();
1354 1354
1355 Node* button = document().querySelector("button", ASSERT_NO_EXCEPTION); 1355 Node* button = document().querySelector("button", ASSERT_NO_EXCEPTION);
1356 EXPECT_TRUE(endsOfNodeAreVisuallyDistinctPositions(button)); 1356 EXPECT_TRUE(endsOfNodeAreVisuallyDistinctPositions(button));
1357 } 1357 }
1358 1358
1359 } // namespace blink 1359 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698