| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 5133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5144 webViewHelper.webView()->settings()->setUnifiedTextCheckerEnabled(true); | 5144 webViewHelper.webView()->settings()->setUnifiedTextCheckerEnabled(true); |
| 5145 webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::Editing
BehaviorWin); | 5145 webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::Editing
BehaviorWin); |
| 5146 | 5146 |
| 5147 element->focus(); | 5147 element->focus(); |
| 5148 NonThrowableExceptionState exceptionState; | 5148 NonThrowableExceptionState exceptionState; |
| 5149 document->execCommand("InsertText", false, "_wellcome_.", exceptionState); | 5149 document->execCommand("InsertText", false, "_wellcome_.", exceptionState); |
| 5150 EXPECT_FALSE(exceptionState.hadException()); | 5150 EXPECT_FALSE(exceptionState.hadException()); |
| 5151 | 5151 |
| 5152 const int allTextBeginOffset = 0; | 5152 const int allTextBeginOffset = 0; |
| 5153 const int allTextLength = 11; | 5153 const int allTextLength = 11; |
| 5154 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al
lTextLength)); | 5154 frame->selectRange(WebRange(allTextBeginOffset, allTextLength)); |
| 5155 EphemeralRange selectionRange = frame->frame()->selection().selection().toNo
rmalizedEphemeralRange(); | 5155 EphemeralRange selectionRange = frame->frame()->selection().selection().toNo
rmalizedEphemeralRange(); |
| 5156 | 5156 |
| 5157 EXPECT_EQ(1, spellcheck.numberOfTimesChecked()); | 5157 EXPECT_EQ(1, spellcheck.numberOfTimesChecked()); |
| 5158 EXPECT_EQ(1U, document->markers().markersInRange(selectionRange, DocumentMar
ker::Spelling).size()); | 5158 EXPECT_EQ(1U, document->markers().markersInRange(selectionRange, DocumentMar
ker::Spelling).size()); |
| 5159 | 5159 |
| 5160 frame->replaceMisspelledRange("welcome"); | 5160 frame->replaceMisspelledRange("welcome"); |
| 5161 EXPECT_EQ("_welcome_.", WebFrameContentDumper::dumpWebViewAsText(webViewHelp
er.webView(), std::numeric_limits<size_t>::max()).utf8()); | 5161 EXPECT_EQ("_welcome_.", WebFrameContentDumper::dumpWebViewAsText(webViewHelp
er.webView(), std::numeric_limits<size_t>::max()).utf8()); |
| 5162 } | 5162 } |
| 5163 | 5163 |
| 5164 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) | 5164 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5178 | 5178 |
| 5179 element->focus(); | 5179 element->focus(); |
| 5180 NonThrowableExceptionState exceptionState; | 5180 NonThrowableExceptionState exceptionState; |
| 5181 document->execCommand("InsertText", false, "_wellcome_.", exceptionState); | 5181 document->execCommand("InsertText", false, "_wellcome_.", exceptionState); |
| 5182 EXPECT_FALSE(exceptionState.hadException()); | 5182 EXPECT_FALSE(exceptionState.hadException()); |
| 5183 | 5183 |
| 5184 frame->removeSpellingMarkers(); | 5184 frame->removeSpellingMarkers(); |
| 5185 | 5185 |
| 5186 const int allTextBeginOffset = 0; | 5186 const int allTextBeginOffset = 0; |
| 5187 const int allTextLength = 11; | 5187 const int allTextLength = 11; |
| 5188 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al
lTextLength)); | 5188 frame->selectRange(WebRange(allTextBeginOffset, allTextLength)); |
| 5189 EphemeralRange selectionRange = frame->frame()->selection().selection().toNo
rmalizedEphemeralRange(); | 5189 EphemeralRange selectionRange = frame->frame()->selection().selection().toNo
rmalizedEphemeralRange(); |
| 5190 | 5190 |
| 5191 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange, DocumentMar
ker::Spelling).size()); | 5191 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange, DocumentMar
ker::Spelling).size()); |
| 5192 } | 5192 } |
| 5193 | 5193 |
| 5194 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) | 5194 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) |
| 5195 { | 5195 { |
| 5196 registerMockedHttpURLLoad("spell.html"); | 5196 registerMockedHttpURLLoad("spell.html"); |
| 5197 FrameTestHelpers::WebViewHelper webViewHelper(this); | 5197 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 5198 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); | 5198 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); |
| (...skipping 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8825 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); | 8825 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); |
| 8826 helper.webView()->mainFrameImpl()->loadRequest(request); | 8826 helper.webView()->mainFrameImpl()->loadRequest(request); |
| 8827 | 8827 |
| 8828 // Normally, the result of the JS url replaces the existing contents on the | 8828 // Normally, the result of the JS url replaces the existing contents on the |
| 8829 // Document. However, if the JS triggers a navigation, the contents should | 8829 // Document. However, if the JS triggers a navigation, the contents should |
| 8830 // not be replaced. | 8830 // not be replaced. |
| 8831 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document(
)->documentElement()->innerText()); | 8831 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document(
)->documentElement()->innerText()); |
| 8832 } | 8832 } |
| 8833 | 8833 |
| 8834 } // namespace blink | 8834 } // namespace blink |
| OLD | NEW |