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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 1155353002: Throw DOMException when invoked Document::execCommand on non-{X,}HTML documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert accidental edit Created 5 years, 6 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 | « Source/core/dom/Document.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index a1d2582f02bbd13c4c3b6937bae771d51ff03d25..9e48b3385b43c931398739f86008b1903ea39a11 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -4977,7 +4977,9 @@ TEST_P(ParameterizedWebFrameTest, ReplaceMisspelledRange)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, "_wellcome_.");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, "_wellcome_.", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
const int allTextBeginOffset = 0;
const int allTextLength = 11;
@@ -5008,7 +5010,9 @@ TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, "_wellcome_.");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, "_wellcome_.", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
frame->removeSpellingMarkers();
@@ -5037,7 +5041,9 @@ TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, " wellcome ");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, " wellcome ", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
WebVector<uint32_t> documentMarkers1;
webViewHelper.webView()->spellingMarkers(&documentMarkers1);
@@ -5071,7 +5077,9 @@ TEST_P(ParameterizedWebFrameTest, MarkerHashIdentifiers)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, "wellcome.");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, "wellcome.", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
WebVector<uint32_t> documentMarkers;
webViewHelper.webView()->spellingMarkers(&documentMarkers);
@@ -5147,9 +5155,12 @@ TEST_P(ParameterizedWebFrameTest, SlowSpellcheckMarkerPosition)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, "wellcome ");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, "wellcome ", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
webInputElement.setSelectionRange(0, 0);
- document->execCommand("InsertText", false, "he");
+ document->execCommand("InsertText", false, "he", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
spellcheck.kick();
@@ -5199,7 +5210,9 @@ TEST_P(ParameterizedWebFrameTest, SpellcheckResultErasesMarkers)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, "welcome ");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, "welcome ", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
document->markers().addMarker(rangeOfContents(element->toNode()).get(), DocumentMarker::Spelling);
document->markers().addMarker(rangeOfContents(element->toNode()).get(), DocumentMarker::Grammar);
document->markers().addMarker(rangeOfContents(element->toNode()).get(), DocumentMarker::InvisibleSpellcheck);
@@ -5228,21 +5241,25 @@ TEST_P(ParameterizedWebFrameTest, SpellcheckResultsSavedInDocument)
webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
element->focus();
- document->execCommand("InsertText", false, "wellcome ");
+ NonThrowableExceptionState exceptionState;
+ document->execCommand("InsertText", false, "wellcome ", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
spellcheck.kick();
ASSERT_EQ(1U, document->markers().markers().size());
ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]);
EXPECT_EQ(DocumentMarker::Spelling, document->markers().markers()[0]->type());
- document->execCommand("InsertText", false, "wellcome ");
+ document->execCommand("InsertText", false, "wellcome ", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
spellcheck.kickGrammar();
ASSERT_EQ(1U, document->markers().markers().size());
ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]);
EXPECT_EQ(DocumentMarker::Grammar, document->markers().markers()[0]->type());
- document->execCommand("InsertText", false, "wellcome ");
+ document->execCommand("InsertText", false, "wellcome ", exceptionState);
+ EXPECT_FALSE(exceptionState.hadException());
spellcheck.kickInvisibleSpellcheck();
ASSERT_EQ(1U, document->markers().markers().size());
« no previous file with comments | « Source/core/dom/Document.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698