Automatic Text Replacement Testing in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=161919
Reviewed by Ryosuke Niwa.
Source/WebCore:
Fixing existing tests:
editing/inserting/smart-link-when-caret-is-moved-before-URL.html
editing/inserting/typing-space-to-trigger-smart-link.html
Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.
* testing/Internals.cpp:
(WebCore::Internals::Internals): Reset TextChecker.
(WebCore::Internals::setContinuousSpellCheckingEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticQuoteSubstitutionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticLinkDetectionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticDashSubstitutionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticTextReplacementEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticSpellingCorrectionEnabled): Converted exception to an assert.
* testing/Internals.h: Removed exception argument for TextChecker setters.
* testing/Internals.idl: Ditto.
Source/WebKit2:
Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.
* UIProcess/API/C/WKTextChecker.cpp: Added #ifdefs to include file for iOS and Mac.
(WKTextCheckerSetTestingMode): Added.
* UIProcess/API/C/WKTextChecker.h: Added #ifdefs to include file for iOS and Mac.
* UIProcess/TextChecker.h: Added hooks to bypass writing to NSUserDefaults.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::toggleSmartInsertDelete): New message to toggle TextChecker flag.
(WebKit::WebPageProxy::toggleAutomaticQuoteSubstitution): Ditto.
(WebKit::WebPageProxy::toggleAutomaticLinkDetection): Ditto.
(WebKit::WebPageProxy::toggleAutomaticDashSubstitution): Ditto.
(WebKit::WebPageProxy::toggleAutomaticTextReplacement): Ditto.
* UIProcess/WebPageProxy.h: Added messages to toggle TextChecker flags.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/efl/TextCheckerEfl.cpp: Implemented new TextChecker hooks for non-Cocoa platforms.
* UIProcess/gtk/TextCheckerGtk.cpp: Ditto.
(WebKit::TextChecker::mutableState): Ditto.
* UIProcess/ios/TextCheckerIOS.mm: Implemented new TextChecker hooks.
(WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
(WebKit::TextChecker::state): Call mutableState.
(WebKit::TextChecker::accessSmartInsertDeleteEnabled): Dummy function.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::refresh): Reload TextChecker configuration from NSUserDefaults.
(WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
(WebKit::TextChecker::state): Call mutableState().
(WebKit::TextChecker::accessSmartInsertDeleteEnabled): Allow toggling of smartInsertDeleteEnabled without writing to NSUserDefaults.
(WebKit::initializeState): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetAutomaticLinkDetectionEnabled): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Removed WKBundleSetAutomaticLinkDetectionEnabled.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setAutomaticLinkDetectionEnabled): Deleted.
* WebKit2.xcodeproj/project.pbxproj: Added WKTextChecker to Mac and iOS.
* WebProcess/InjectedBundle/InjectedBundle.h: Remove setAutomaticLinkDetectionEnabled.
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::WebEditorClient::toggleSmartInsertDelete): Send message to UI process to toggle TextChecker.
(WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution): Ditto.
(WebKit::WebEditorClient::toggleAutomaticLinkDetection): Ditto.
(WebKit::WebEditorClient::toggleAutomaticDashSubstitution): Ditto.
(WebKit::WebEditorClient::toggleAutomaticTextReplacement): Ditto.
Tools:
Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Removed setAutomaticLinkDetectionEnabled from TestRunner, moved to Internals.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Ditto.
(WTR::InjectedBundle::beginTesting): Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp: Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.h: Ditto.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::runTest): Place TextChecker into testing mode.
LayoutTests:
Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.
* editing/inserting/smart-link-when-caret-is-moved-before-URL.html: Use internals instead of TestRunner.
* editing/inserting/typing-space-to-trigger-smart-link.html: Ditto.
* platform/efl/TestExpectations: Added port specific tests.
* platform/gtk/TestExpectations: Added port specific tests.
* platform/ios-simulator/TestExpectations: Added port specific tests.
* platform/ios-simulator-wk1/TestExpectations: Moved skipped tests to ios-simulator.
* platform/ios-simulator-wk2/TestExpectations: Moved skipped tests to ios-simulator.
* platform/mac-wk2/TestExpectations: Removed passing test.
* platform/win/TestExpectations: Added port specific tests.
* platform/wk2/TestExpectations: Added better explanation for failing test.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h
index a64fd291..41378c2 100644
--- a/Source/WebKit2/UIProcess/TextChecker.h
+++ b/Source/WebKit2/UIProcess/TextChecker.h
@@ -42,6 +42,9 @@
static void setContinuousSpellCheckingEnabled(bool);
static void setGrammarCheckingEnabled(bool);
+
+ static void setTestingMode(bool);
+ static bool isTestingMode();
#if PLATFORM(COCOA)
static void setAutomaticSpellingCorrectionEnabled(bool);