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

Side by Side Diff: Source/WebKit/chromium/tests/WebFrameTest.cpp

Issue 13896014: Enable removing spelling markers in a frame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 /* 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 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 EXPECT_EQ(1, spellcheck.numberOfTimesChecked()); 2568 EXPECT_EQ(1, spellcheck.numberOfTimesChecked());
2569 EXPECT_EQ(1U, document->markers()->markersInRange(selectionRange.get(), Docu mentMarker::Spelling).size()); 2569 EXPECT_EQ(1U, document->markers()->markersInRange(selectionRange.get(), Docu mentMarker::Spelling).size());
2570 2570
2571 frame->replaceMisspelledRange("welcome"); 2571 frame->replaceMisspelledRange("welcome");
2572 EXPECT_EQ("_welcome_.", std::string(frame->contentAsText(std::numeric_limits <size_t>::max()).utf8().data())); 2572 EXPECT_EQ("_welcome_.", std::string(frame->contentAsText(std::numeric_limits <size_t>::max()).utf8().data()));
2573 2573
2574 m_webView->close(); 2574 m_webView->close();
2575 m_webView = 0; 2575 m_webView = 0;
2576 } 2576 }
2577 2577
2578 TEST_F(WebFrameTest, RemoveSpellingMarkers)
2579 {
2580 registerMockedHttpURLLoad("spell.html");
2581 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html") ;
2582 SpellCheckClient spellcheck;
2583 m_webView->setSpellCheckClient(&spellcheck);
2584
2585 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
2586 Document* document = frame->frame()->document();
2587 Element* element = document->getElementById("data");
2588
2589 frame->frame()->settings()->setAsynchronousSpellCheckingEnabled(true);
2590 frame->frame()->settings()->setUnifiedTextCheckerEnabled(true);
2591 frame->frame()->settings()->setEditingBehaviorType(WebCore::EditingWindowsBe havior);
2592
2593 element->focus();
2594 document->execCommand("InsertText", false, "_wellcome_.");
2595
2596 frame->removeSpellingMarkers();
2597
2598 const int allTextBeginOffset = 0;
2599 const int allTextLength = 11;
2600 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al lTextLength));
2601 RefPtr<Range> selectionRange = frame->frame()->selection()->toNormalizedRang e();
2602
2603 EXPECT_EQ(0U, document->markers()->markersInRange(selectionRange.get(), Docu mentMarker::Spelling).size());
2604
2605 m_webView->close();
2606 m_webView = 0;
2607 }
2608
2578 class TestAccessInitialDocumentWebFrameClient : public WebFrameClient { 2609 class TestAccessInitialDocumentWebFrameClient : public WebFrameClient {
2579 public: 2610 public:
2580 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false ) 2611 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false )
2581 { 2612 {
2582 } 2613 }
2583 2614
2584 virtual void didAccessInitialDocument(WebFrame* frame) 2615 virtual void didAccessInitialDocument(WebFrame* frame)
2585 { 2616 {
2586 EXPECT_TRUE(!m_didAccessInitialDocument); 2617 EXPECT_TRUE(!m_didAccessInitialDocument);
2587 m_didAccessInitialDocument = true; 2618 m_didAccessInitialDocument = true;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 EXPECT_FALSE(client.wasProgrammaticScroll()); 2783 EXPECT_FALSE(client.wasProgrammaticScroll());
2753 EXPECT_TRUE(client.wasUserScroll()); 2784 EXPECT_TRUE(client.wasUserScroll());
2754 client.reset(); 2785 client.reset();
2755 2786
2756 m_webView->close(); 2787 m_webView->close();
2757 m_webView = 0; 2788 m_webView = 0;
2758 } 2789 }
2759 2790
2760 2791
2761 } // namespace 2792 } // namespace
OLDNEW
« Source/WebKit/chromium/src/WebFrameImpl.h ('K') | « Source/WebKit/chromium/src/WebFrameImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698