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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2201783002: Remove grammar marker inspection from WebFrameTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5271 matching lines...) Expand 10 before | Expand all | Expand 10 after
5282 void kickNoResults() 5282 void kickNoResults()
5283 { 5283 {
5284 kick(-1, -1, WebTextDecorationTypeSpelling); 5284 kick(-1, -1, WebTextDecorationTypeSpelling);
5285 } 5285 }
5286 5286
5287 void kick() 5287 void kick()
5288 { 5288 {
5289 kick(1, 8, WebTextDecorationTypeSpelling); 5289 kick(1, 8, WebTextDecorationTypeSpelling);
5290 } 5290 }
5291 5291
5292 void kickGrammar()
5293 {
5294 kick(1, 8, WebTextDecorationTypeGrammar);
5295 }
5296
5297 void kickInvisibleSpellcheck() 5292 void kickInvisibleSpellcheck()
5298 { 5293 {
5299 kick(1, 8, WebTextDecorationTypeInvisibleSpellcheck); 5294 kick(1, 8, WebTextDecorationTypeInvisibleSpellcheck);
5300 } 5295 }
5301 5296
5302 private: 5297 private:
5303 void kick(int misspellingStartOffset, int misspellingLength, WebTextDecorati onType type) 5298 void kick(int misspellingStartOffset, int misspellingLength, WebTextDecorati onType type)
5304 { 5299 {
5305 if (!m_completion) 5300 if (!m_completion)
5306 return; 5301 return;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
5383 5378
5384 element->focus(); 5379 element->focus();
5385 NonThrowableExceptionState exceptionState; 5380 NonThrowableExceptionState exceptionState;
5386 document->execCommand("InsertText", false, "welcome ", exceptionState); 5381 document->execCommand("InsertText", false, "welcome ", exceptionState);
5387 5382
5388 document->updateStyleAndLayout(); 5383 document->updateStyleAndLayout();
5389 5384
5390 EXPECT_FALSE(exceptionState.hadException()); 5385 EXPECT_FALSE(exceptionState.hadException());
5391 auto range = EphemeralRange::rangeOfContents(*element); 5386 auto range = EphemeralRange::rangeOfContents(*element);
5392 document->markers().addMarker(range.startPosition(), range.endPosition(), Do cumentMarker::Spelling); 5387 document->markers().addMarker(range.startPosition(), range.endPosition(), Do cumentMarker::Spelling);
5393 document->markers().addMarker(range.startPosition(), range.endPosition(), Do cumentMarker::Grammar);
5394 document->markers().addMarker(range.startPosition(), range.endPosition(), Do cumentMarker::InvisibleSpellcheck); 5388 document->markers().addMarker(range.startPosition(), range.endPosition(), Do cumentMarker::InvisibleSpellcheck);
5395 EXPECT_EQ(3U, document->markers().markers().size()); 5389 EXPECT_EQ(2U, document->markers().markers().size());
5396 5390
5397 spellcheck.kickNoResults(); 5391 spellcheck.kickNoResults();
5398 EXPECT_EQ(0U, document->markers().markers().size()); 5392 EXPECT_EQ(0U, document->markers().markers().size());
5399 } 5393 }
5400 5394
5401 TEST_P(ParameterizedWebFrameTest, SpellcheckResultsSavedInDocument) 5395 TEST_P(ParameterizedWebFrameTest, SpellcheckResultsSavedInDocument)
5402 { 5396 {
5403 registerMockedHttpURLLoad("spell.html"); 5397 registerMockedHttpURLLoad("spell.html");
5404 FrameTestHelpers::WebViewHelper webViewHelper(this); 5398 FrameTestHelpers::WebViewHelper webViewHelper(this);
5405 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); 5399 webViewHelper.initializeAndLoad(m_baseURL + "spell.html");
(...skipping 14 matching lines...) Expand all
5420 EXPECT_FALSE(exceptionState.hadException()); 5414 EXPECT_FALSE(exceptionState.hadException());
5421 5415
5422 spellcheck.kick(); 5416 spellcheck.kick();
5423 ASSERT_EQ(1U, document->markers().markers().size()); 5417 ASSERT_EQ(1U, document->markers().markers().size());
5424 ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]) ; 5418 ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]) ;
5425 EXPECT_EQ(DocumentMarker::Spelling, document->markers().markers()[0]->type() ); 5419 EXPECT_EQ(DocumentMarker::Spelling, document->markers().markers()[0]->type() );
5426 5420
5427 document->execCommand("InsertText", false, "wellcome ", exceptionState); 5421 document->execCommand("InsertText", false, "wellcome ", exceptionState);
5428 EXPECT_FALSE(exceptionState.hadException()); 5422 EXPECT_FALSE(exceptionState.hadException());
5429 5423
5430 spellcheck.kickGrammar();
5431 ASSERT_EQ(1U, document->markers().markers().size());
5432 ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]) ;
5433 EXPECT_EQ(DocumentMarker::Grammar, document->markers().markers()[0]->type()) ;
5434
5435 document->execCommand("InsertText", false, "wellcome ", exceptionState);
5436 EXPECT_FALSE(exceptionState.hadException());
5437
5438 spellcheck.kickInvisibleSpellcheck(); 5424 spellcheck.kickInvisibleSpellcheck();
5439 ASSERT_EQ(1U, document->markers().markers().size()); 5425 ASSERT_EQ(1U, document->markers().markers().size());
5440 ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]) ; 5426 ASSERT_NE(static_cast<DocumentMarker*>(0), document->markers().markers()[0]) ;
5441 EXPECT_EQ(DocumentMarker::InvisibleSpellcheck, document->markers().markers() [0]->type()); 5427 EXPECT_EQ(DocumentMarker::InvisibleSpellcheck, document->markers().markers() [0]->type());
5442 } 5428 }
5443 5429
5444 class TestAccessInitialDocumentWebFrameClient : public FrameTestHelpers::TestWeb FrameClient { 5430 class TestAccessInitialDocumentWebFrameClient : public FrameTestHelpers::TestWeb FrameClient {
5445 public: 5431 public:
5446 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false ) 5432 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false )
5447 { 5433 {
(...skipping 3390 matching lines...) Expand 10 before | Expand all | Expand 10 after
8838 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 8824 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
8839 helper.webView()->mainFrameImpl()->loadRequest(request); 8825 helper.webView()->mainFrameImpl()->loadRequest(request);
8840 8826
8841 // Normally, the result of the JS url replaces the existing contents on the 8827 // Normally, the result of the JS url replaces the existing contents on the
8842 // Document. However, if the JS triggers a navigation, the contents should 8828 // Document. However, if the JS triggers a navigation, the contents should
8843 // not be replaced. 8829 // not be replaced.
8844 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document( )->documentElement()->innerText()); 8830 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document( )->documentElement()->innerText());
8845 } 8831 }
8846 8832
8847 } // namespace blink 8833 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698