| 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 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4513 frame->removeSpellingMarkers(); | 4513 frame->removeSpellingMarkers(); |
| 4514 | 4514 |
| 4515 const int allTextBeginOffset = 0; | 4515 const int allTextBeginOffset = 0; |
| 4516 const int allTextLength = 11; | 4516 const int allTextLength = 11; |
| 4517 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al
lTextLength)); | 4517 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al
lTextLength)); |
| 4518 RefPtrWillBeRawPtr<Range> selectionRange = frame->frame()->selection().toNor
malizedRange(); | 4518 RefPtrWillBeRawPtr<Range> selectionRange = frame->frame()->selection().toNor
malizedRange(); |
| 4519 | 4519 |
| 4520 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), Docum
entMarker::Spelling).size()); | 4520 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), Docum
entMarker::Spelling).size()); |
| 4521 } | 4521 } |
| 4522 | 4522 |
| 4523 TEST_F(WebFrameTest, RemoveSpellingMarkersUnderWords) |
| 4524 { |
| 4525 registerMockedHttpURLLoad("spell.html"); |
| 4526 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4527 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); |
| 4528 SpellCheckClient spellcheck; |
| 4529 webViewHelper.webView()->setSpellCheckClient(&spellcheck); |
| 4530 |
| 4531 LocalFrame* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()
)->frame(); |
| 4532 Document* document = frame->document(); |
| 4533 Element* element = document->getElementById("data"); |
| 4534 |
| 4535 webViewHelper.webView()->settings()->setAsynchronousSpellCheckingEnabled(tru
e); |
| 4536 webViewHelper.webView()->settings()->setUnifiedTextCheckerEnabled(true); |
| 4537 webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::Editing
BehaviorWin); |
| 4538 |
| 4539 element->focus(); |
| 4540 document->execCommand("InsertText", false, " wellcome "); |
| 4541 |
| 4542 WebVector<uint32_t> documentMarkers1; |
| 4543 webViewHelper.webView()->spellingMarkers(&documentMarkers1); |
| 4544 EXPECT_EQ(1U, documentMarkers1.size()); |
| 4545 |
| 4546 Vector<String> words; |
| 4547 words.append("wellcome"); |
| 4548 frame->removeSpellingMarkersUnderWords(words); |
| 4549 |
| 4550 WebVector<uint32_t> documentMarkers2; |
| 4551 webViewHelper.webView()->spellingMarkers(&documentMarkers2); |
| 4552 EXPECT_EQ(0U, documentMarkers2.size()); |
| 4553 } |
| 4554 |
| 4523 TEST_F(WebFrameTest, MarkerHashIdentifiers) { | 4555 TEST_F(WebFrameTest, MarkerHashIdentifiers) { |
| 4524 registerMockedHttpURLLoad("spell.html"); | 4556 registerMockedHttpURLLoad("spell.html"); |
| 4525 FrameTestHelpers::WebViewHelper webViewHelper; | 4557 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4526 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); | 4558 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); |
| 4527 | 4559 |
| 4528 static const uint32_t kHash = 42; | 4560 static const uint32_t kHash = 42; |
| 4529 SpellCheckClient spellcheck(kHash); | 4561 SpellCheckClient spellcheck(kHash); |
| 4530 webViewHelper.webView()->setSpellCheckClient(&spellcheck); | 4562 webViewHelper.webView()->setSpellCheckClient(&spellcheck); |
| 4531 | 4563 |
| 4532 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main
Frame()); | 4564 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main
Frame()); |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6045 | 6077 |
| 6046 client.reset(); | 6078 client.reset(); |
| 6047 // Try to load the request with cross origin access. Should succeed. | 6079 // Try to load the request with cross origin access. Should succeed. |
| 6048 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; | 6080 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; |
| 6049 blink::DocumentThreadableLoader::loadResourceSynchronously( | 6081 blink::DocumentThreadableLoader::loadResourceSynchronously( |
| 6050 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); | 6082 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); |
| 6051 EXPECT_FALSE(client.failed()); | 6083 EXPECT_FALSE(client.failed()); |
| 6052 } | 6084 } |
| 6053 | 6085 |
| 6054 } // namespace | 6086 } // namespace |
| OLD | NEW |