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 4399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4410 frame->removeSpellingMarkers(); | 4410 frame->removeSpellingMarkers(); |
4411 | 4411 |
4412 const int allTextBeginOffset = 0; | 4412 const int allTextBeginOffset = 0; |
4413 const int allTextLength = 11; | 4413 const int allTextLength = 11; |
4414 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al
lTextLength)); | 4414 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al
lTextLength)); |
4415 RefPtrWillBeRawPtr<Range> selectionRange = frame->frame()->selection().toNor
malizedRange(); | 4415 RefPtrWillBeRawPtr<Range> selectionRange = frame->frame()->selection().toNor
malizedRange(); |
4416 | 4416 |
4417 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), Docum
entMarker::Spelling).size()); | 4417 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), Docum
entMarker::Spelling).size()); |
4418 } | 4418 } |
4419 | 4419 |
| 4420 TEST_F(WebFrameTest, RemoveSpellingMarkersUnderWords) |
| 4421 { |
| 4422 registerMockedHttpURLLoad("spell.html"); |
| 4423 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4424 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); |
| 4425 SpellCheckClient spellcheck; |
| 4426 webViewHelper.webView()->setSpellCheckClient(&spellcheck); |
| 4427 |
| 4428 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main
Frame()); |
| 4429 Document* document = frame->frame()->document(); |
| 4430 Element* element = document->getElementById("data"); |
| 4431 |
| 4432 webViewHelper.webView()->settings()->setAsynchronousSpellCheckingEnabled(tru
e); |
| 4433 webViewHelper.webView()->settings()->setUnifiedTextCheckerEnabled(true); |
| 4434 webViewHelper.webView()->settings()->setEditingBehavior(WebSettings::Editing
BehaviorWin); |
| 4435 |
| 4436 element->focus(); |
| 4437 document->execCommand("InsertText", false, " wellcome "); |
| 4438 |
| 4439 WebVector<uint32_t> documentMarkers1; |
| 4440 webViewHelper.webView()->spellingMarkers(&documentMarkers1); |
| 4441 EXPECT_EQ(1U, documentMarkers1.size()); |
| 4442 |
| 4443 WebString word = WebString::fromUTF8("wellcome"); |
| 4444 WebVector<WebString> words(&word, 1); |
| 4445 frame->removeSpellingMarkersUnderWords(words); |
| 4446 |
| 4447 WebVector<uint32_t> documentMarkers2; |
| 4448 webViewHelper.webView()->spellingMarkers(&documentMarkers2); |
| 4449 EXPECT_EQ(0U, documentMarkers2.size()); |
| 4450 } |
| 4451 |
4420 TEST_F(WebFrameTest, MarkerHashIdentifiers) { | 4452 TEST_F(WebFrameTest, MarkerHashIdentifiers) { |
4421 registerMockedHttpURLLoad("spell.html"); | 4453 registerMockedHttpURLLoad("spell.html"); |
4422 FrameTestHelpers::WebViewHelper webViewHelper; | 4454 FrameTestHelpers::WebViewHelper webViewHelper; |
4423 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); | 4455 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); |
4424 | 4456 |
4425 static const uint32_t kHash = 42; | 4457 static const uint32_t kHash = 42; |
4426 SpellCheckClient spellcheck(kHash); | 4458 SpellCheckClient spellcheck(kHash); |
4427 webViewHelper.webView()->setSpellCheckClient(&spellcheck); | 4459 webViewHelper.webView()->setSpellCheckClient(&spellcheck); |
4428 | 4460 |
4429 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main
Frame()); | 4461 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main
Frame()); |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5921 | 5953 |
5922 client.reset(); | 5954 client.reset(); |
5923 // Try to load the request with cross origin access. Should succeed. | 5955 // Try to load the request with cross origin access. Should succeed. |
5924 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; | 5956 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; |
5925 blink::DocumentThreadableLoader::loadResourceSynchronously( | 5957 blink::DocumentThreadableLoader::loadResourceSynchronously( |
5926 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); | 5958 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); |
5927 EXPECT_FALSE(client.failed()); | 5959 EXPECT_FALSE(client.failed()); |
5928 } | 5960 } |
5929 | 5961 |
5930 } // namespace | 5962 } // namespace |
OLD | NEW |