Changeset 188828 in webkit


Ignore:
Timestamp:
Aug 22, 2015 3:20:46 PM (9 years ago)
Author:
timothy_horton@apple.com
Message:

WebKitTestRunner should use WKWebView on OS X and iOS
https://bugs.webkit.org/show_bug.cgi?id=143743
<rdar://problem/16947123>

Reviewed by Anders Carlsson.
Patch by Enrica Casucci and myself.

  • WebKitTestRunner/PlatformWebView.h:

(WTR::PlatformWebView::windowSnapshotEnabled): Deleted.
Add a PlatformWebView constructor that takes a WKWebViewConfiguration
instead of WKContext and WKPageGroup.

Remove the unused, always-true windowSnapshotEnabled().
While technically some platforms don't have window snapshotting,
they just return null instead of implementing windowSnapshotEnabled().

  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::createOtherPage):
(WTR::TestController::initialize):
(WTR::TestController::createWebViewWithOptions):
Delegate to the various platforms for creating PlatformWebView instances,
for creating WKContexts, and for accessing WKPreferences,
so that they can do special things (like, use WKWebView instead!).

(WTR::TestController::resetPreferencesToConsistentValues):
Make explicit WebKitTestRunner's desired default for two preferences
which have differing defaults between the antique and modern API,
for consistency's sake.

(WTR::TestController::resetStateToConsistentValues):
Add platformResetStateToConsistentValues.

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::dumpResults):
Adjust to the aforementioned removal of windowSnapshotEnabled().

  • WebKitTestRunner/ios/TestControllerCocoa.mm:

(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformPreferences):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::platformCreateOtherPage):
(WTR::TestController::platformInitializeConfiguration):
Implement the new platform functions for the Modern WebKit2 API,
in a new TestControllerCocoa file that is shared between iOS and Mac.

For platformMaybeCreateContext, use the trick that we know we can cast
the WKProcessPool to a WKContextRef to retrieve a WKContextRef from
WKWebView's configuration.

Ditto for WKPreferencesRef and WKPreferences.

Remove user content filters on the WKWebView's userContentController.

  • WebKitTestRunner/mac/TestControllerMac.mm:
  • WebKitTestRunner/ios/TestControllerIOS.mm:

Move code into TestControllerCocoa.

  • WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:

(WTR::InjectedBundle::beginTesting):

  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::addUserScript):
(WTR::TestRunner::addUserStyleSheet):
Adopt WKBundlePage API for user scripts/sheets.

  • WebKitTestRunner/ios/PlatformWebViewIOS.mm:
  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

Make and keep a WKWebView instead of a WKView.

  • WebKitTestRunner/mac/EventSenderProxy.mm:

(WTR::EventSenderProxy::mouseUp):
(WTR::EventSenderProxy::mouseMoveTo):
Reach inside the WKWebView to the WKView when dispatching events.
This is fairly ugly and we should come up with a better solution.
Also, fix some flipping and style errors.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _windowOcclusionDetectionEnabled]):
(-[WKWebView _setWindowOcclusionDetectionEnabled:]):

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:

Add SPI to disable window occlusion detection, for WebKitTestRunner's use.

  • Shared/WebPreferencesDefinitions.h:

Remove a completely unused WebPreference. It is a WebCore Setting,
but in the API it's exposed as a WKPage setter and WKView and WKWebView property
instead of as a WKPreference, so there's no need for the WebPreference.

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageAddUserScript):
(WKBundlePageAddUserStyleSheet):
(WKBundlePageRemoveAllUserContent):

  • WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::addUserScript):
(WebKit::WebPage::addUserStyleSheet):
(WebKit::WebPage::removeAllUserContent):

  • WebProcess/WebPage/WebPage.h:

Add WKBundlePage functions for user script and style sheet manipulation.
These use the WebPage's WebUserContentController instead of the WebPageGroupProxy's
(used by the WKBundle functions), so they work correctly with the modern API.

Location:
trunk
Files:
1 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r188826 r188828  
     12015-08-22  Timothy Horton  <timothy_horton@apple.com>
     2
     3        WebKitTestRunner should use WKWebView on OS X and iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=143743
     5        <rdar://problem/16947123>
     6
     7        Reviewed by Anders Carlsson.
     8        Patch by Enrica Casucci and myself.
     9
     10        * UIProcess/API/Cocoa/WKWebView.mm:
     11        (-[WKWebView _windowOcclusionDetectionEnabled]):
     12        (-[WKWebView _setWindowOcclusionDetectionEnabled:]):
     13        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     14        Add SPI to disable window occlusion detection, for WebKitTestRunner's use.
     15
     16        * Shared/WebPreferencesDefinitions.h:
     17        Remove a completely unused WebPreference. It is a WebCore Setting,
     18        but in the API it's exposed as a WKPage setter and WKView and WKWebView property
     19        instead of as a WKPreference, so there's no need for the WebPreference.
     20
     21        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     22        (WKBundlePageAddUserScript):
     23        (WKBundlePageAddUserStyleSheet):
     24        (WKBundlePageRemoveAllUserContent):
     25        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
     26        * WebProcess/WebPage/WebPage.cpp:
     27        (WebKit::WebPage::addUserScript):
     28        (WebKit::WebPage::addUserStyleSheet):
     29        (WebKit::WebPage::removeAllUserContent):
     30        * WebProcess/WebPage/WebPage.h:
     31        Add WKBundlePage functions for user script and style sheet manipulation.
     32        These use the WebPage's WebUserContentController instead of the WebPageGroupProxy's
     33        (used by the WKBundle functions), so they work correctly with the modern API.
     34
    1352015-08-22  Michael Catanzaro  <mcatanzaro@igalia.com>
    236
  • trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h

    r188817 r188828  
    181181    macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true) \
    182182    macro(SubpixelCSSOMElementMetricsEnabled, subpixelCSSOMElementMetricsEnabled, Bool, bool, false) \
    183     macro(BackgroundShouldExtendBeyondPage, backgroundShouldExtendBeyondPage, Bool, bool, false) \
    184183    macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false) \
    185184    macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false) \
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r188817 r188828  
    30843084}
    30853085
     3086- (BOOL)_windowOcclusionDetectionEnabled
     3087{
     3088    return [_wkView windowOcclusionDetectionEnabled];
     3089}
     3090
     3091- (void)_setWindowOcclusionDetectionEnabled:(BOOL)flag
     3092{
     3093    [_wkView setWindowOcclusionDetectionEnabled:flag];
     3094}
     3095
    30863096#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
    30873097
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r188817 r188828  
    174174// Default value is 0. A value of 0 means the window's backing scale factor will be used and automatically update when the window moves screens.
    175175@property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
     176
     177@property (nonatomic, setter=_setWindowOcclusionDetectionEnabled:) BOOL _windowOcclusionDetectionEnabled;
     178
    176179#endif
    177180
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r188817 r188828  
    616616        *returnDataRef = toAPI(returnData.release().leakRef());
    617617}
     618
     619void WKBundlePageAddUserScript(WKBundlePageRef pageRef, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames)
     620{
     621    toImpl(pageRef)->addUserScript(toWTFString(source), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime));
     622}
     623
     624void WKBundlePageAddUserStyleSheet(WKBundlePageRef pageRef, WKStringRef source, WKUserContentInjectedFrames injectedFrames)
     625{
     626    toImpl(pageRef)->addUserStyleSheet(toWTFString(source), toUserContentInjectedFrames(injectedFrames));
     627}
     628
     629void WKBundlePageRemoveAllUserContent(WKBundlePageRef pageRef)
     630{
     631    toImpl(pageRef)->removeAllUserContent();
     632}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h

    r188817 r188828  
    3030#include <WebKit/WKEvent.h>
    3131#include <WebKit/WKGeometry.h>
     32#include <WebKit/WKUserContentInjectedFrames.h>
     33#include <WebKit/WKUserScriptInjectionTime.h>
    3234
    3335#ifdef __cplusplus
     
    9496WK_EXPORT void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef, WKRenderingSuppressionToken);
    9597
     98// UserContent API (compatible with Modern API, for WKTR)
     99WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
     100WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames);
     101WK_EXPORT void WKBundlePageRemoveAllUserContent(WKBundlePageRef page);
     102
    96103#if TARGET_OS_IPHONE
    97104WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r188817 r188828  
    50075007}
    50085008
     5009void WebPage::addUserScript(const String& source, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)
     5010{
     5011    ASSERT(m_userContentController);
     5012
     5013    WebCore::UserScript userScript(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectionTime, injectedFrames);
     5014
     5015    m_userContentController->userContentController().addUserScript(mainThreadNormalWorld(), std::make_unique<WebCore::UserScript>(userScript));
     5016}
     5017
     5018void WebPage::addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames injectedFrames)
     5019{
     5020    ASSERT(m_userContentController);
     5021
     5022    WebCore::UserStyleSheet userStyleSheet(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectedFrames, UserStyleUserLevel);
     5023
     5024    m_userContentController->userContentController().addUserStyleSheet(mainThreadNormalWorld(), std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), InjectInExistingDocuments);
     5025}
     5026
     5027void WebPage::removeAllUserContent()
     5028{
     5029    if (!m_userContentController)
     5030        return;
     5031
     5032    m_userContentController->userContentController().removeAllUserContent();
     5033}
     5034
    50095035} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r188817 r188828  
    6464#include <WebCore/TextIndicator.h>
    6565#include <WebCore/UserActivity.h>
     66#include <WebCore/UserContentTypes.h>
     67#include <WebCore/UserScriptTypes.h>
    6668#include <WebCore/ViewState.h>
    6769#include <WebCore/ViewportConfiguration.h>
     
    915917#endif
    916918
     919    void addUserScript(const String& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
     920    void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
     921    void removeAllUserContent();
     922
    917923private:
    918924    WebPage(uint64_t pageID, const WebPageCreationParameters&);
  • trunk/Tools/ChangeLog

    r188826 r188828  
     12015-08-22  Timothy Horton  <timothy_horton@apple.com>
     2
     3        WebKitTestRunner should use WKWebView on OS X and iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=143743
     5        <rdar://problem/16947123>
     6
     7        Reviewed by Anders Carlsson.
     8        Patch by Enrica Casucci and myself.
     9
     10        * WebKitTestRunner/PlatformWebView.h:
     11        (WTR::PlatformWebView::windowSnapshotEnabled): Deleted.
     12        Add a PlatformWebView constructor that takes a WKWebViewConfiguration
     13        instead of WKContext and WKPageGroup.
     14
     15        Remove the unused, always-true windowSnapshotEnabled().
     16        While technically some platforms don't have window snapshotting,
     17        they just return null instead of implementing windowSnapshotEnabled().
     18
     19        * WebKitTestRunner/TestController.h:
     20        * WebKitTestRunner/TestController.cpp:
     21        (WTR::TestController::createOtherPage):
     22        (WTR::TestController::initialize):
     23        (WTR::TestController::createWebViewWithOptions):
     24        Delegate to the various platforms for creating PlatformWebView instances,
     25        for creating WKContexts, and for accessing WKPreferences,
     26        so that they can do special things (like, use WKWebView instead!).
     27
     28        (WTR::TestController::resetPreferencesToConsistentValues):
     29        Make explicit WebKitTestRunner's desired default for two preferences
     30        which have differing defaults between the antique and modern API,
     31        for consistency's sake.
     32
     33        (WTR::TestController::resetStateToConsistentValues):
     34        Add platformResetStateToConsistentValues.
     35
     36        * WebKitTestRunner/TestInvocation.cpp:
     37        (WTR::TestInvocation::dumpResults):
     38        Adjust to the aforementioned removal of windowSnapshotEnabled().
     39
     40        * WebKitTestRunner/ios/TestControllerCocoa.mm:
     41        (WTR::TestController::platformResetStateToConsistentValues):
     42        (WTR::TestController::platformPreferences):
     43        (WTR::TestController::platformCreateWebView):
     44        (WTR::TestController::platformCreateOtherPage):
     45        (WTR::TestController::platformInitializeConfiguration):
     46        Implement the new platform functions for the Modern WebKit2 API,
     47        in a new TestControllerCocoa file that is shared between iOS and Mac.
     48       
     49        For platformMaybeCreateContext, use the trick that we know we can cast
     50        the WKProcessPool to a WKContextRef to retrieve a WKContextRef from
     51        WKWebView's configuration.
     52
     53        Ditto for WKPreferencesRef and WKPreferences.
     54
     55        Remove user content filters on the WKWebView's userContentController.
     56
     57        * WebKitTestRunner/mac/TestControllerMac.mm:
     58        * WebKitTestRunner/ios/TestControllerIOS.mm:
     59        Move code into TestControllerCocoa.
     60
     61        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     62        (WTR::InjectedBundle::beginTesting):
     63        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     64        (WTR::TestRunner::addUserScript):
     65        (WTR::TestRunner::addUserStyleSheet):
     66        Adopt WKBundlePage API for user scripts/sheets.
     67
     68        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
     69        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     70        Make and keep a WKWebView instead of a WKView.
     71       
     72        * WebKitTestRunner/mac/EventSenderProxy.mm:
     73        (WTR::EventSenderProxy::mouseUp):
     74        (WTR::EventSenderProxy::mouseMoveTo):
     75        Reach inside the WKWebView to the WKView when dispatching events.
     76        This is fairly ugly and we should come up with a better solution.
     77        Also, fix some flipping and style errors.
     78
    1792015-08-22  Michael Catanzaro  <mcatanzaro@igalia.com>
    280
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r188817 r188828  
    262262    WKBundleSetPopupBlockingEnabled(m_bundle, m_pageGroup, false);
    263263
    264     WKBundleRemoveAllUserContent(m_bundle, m_pageGroup);
     264    WKBundlePageRemoveAllUserContent(page()->page());
    265265
    266266    m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r188817 r188828  
    173173{
    174174    WKRetainPtr<WKStringRef> sourceWK = toWK(source);
    175     WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
    176 
    177     auto& injectedBundle = InjectedBundle::singleton();
    178     WKBundleAddUserScript(injectedBundle.bundle(), injectedBundle.pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
     175
     176    WKBundlePageAddUserScript(InjectedBundle::singleton().page()->page(), sourceWK.get(),
    179177        (runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd),
    180178        (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
     
    184182{
    185183    WKRetainPtr<WKStringRef> sourceWK = toWK(source);
    186     WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
    187 
    188     auto& injectedBundle = InjectedBundle::singleton();
    189     WKBundleAddUserStyleSheet(injectedBundle.bundle(), injectedBundle.pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
     184
     185    WKBundlePageAddUserStyleSheet(InjectedBundle::singleton().page()->page(), sourceWK.get(),
    190186        (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
    191187}
  • trunk/Tools/WebKitTestRunner/PlatformWebView.h

    r188817 r188828  
    2828
    2929#include "ViewOptions.h"
     30#include <WebKit/WKFoundation.h>
    3031#include <WebKit/WKRetainPtr.h>
    3132
    32 #if defined(__APPLE__) && __APPLE__
    33 #ifdef __OBJC__
    34 @class WKView;
    35 @class WebKitTestRunnerWindow;
     33#if PLATFORM(COCOA)
     34OBJC_CLASS NSView;
     35OBJC_CLASS UIView;
     36OBJC_CLASS WKWebView;
     37OBJC_CLASS WKWebViewConfiguration;
     38OBJC_CLASS WebKitTestRunnerWindow;
     39
     40#if WK_API_ENABLED
     41typedef WKWebView *PlatformWKView;
    3642#else
    37 class WKView;
    38 class WebKitTestRunnerWindow;
     43typedef NSView *PlatformWKView;
    3944#endif
    40 typedef WKView* PlatformWKView;
    41 typedef WebKitTestRunnerWindow* PlatformWindow;
     45typedef WebKitTestRunnerWindow *PlatformWindow;
    4246#elif defined(BUILDING_GTK__)
    4347typedef struct _GtkWidget GtkWidget;
     
    5357class PlatformWebView {
    5458public:
     59#if PLATFORM(COCOA)
     60    PlatformWebView(WKWebViewConfiguration*, const ViewOptions&);
     61#else
    5562    PlatformWebView(WKPageConfigurationRef, const ViewOptions&);
     63#endif
    5664    ~PlatformWebView();
    5765
     
    6169    void resizeTo(unsigned width, unsigned height);
    6270    void focus();
    63 
    64     // Window snapshot is always enabled by default on all other platform.
    65     static bool windowSnapshotEnabled() { return true; }
    6671
    6772    WKRect windowFrame();
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r188817 r188828  
    198198}
    199199
    200 WKPageRef TestController::createOtherPage(WKPageRef oldPpage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
     200WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
    201201{
    202202    PlatformWebView* parentView = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
    203203
    204     PlatformWebView* view = new PlatformWebView(configuration, parentView->options());
     204    PlatformWebView* view = platformCreateOtherPage(parentView, configuration, parentView->options());
    205205    WKPageRef newPage = view->page();
    206206
     
    311311}
    312312
    313 
    314313void TestController::initialize(int argc, const char* argv[])
    315314{
     
    373372        WKContextConfigurationSetMediaKeysStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "MediaKeys").get());
    374373    }
    375 
    376     m_context = adoptWK(WKContextCreateWithConfiguration(configuration.get()));
     374    m_context = platformAdjustContext(adoptWK(WKContextCreateWithConfiguration(configuration.get())).get(), configuration.get());
     375
    377376    m_geolocationProvider = std::make_unique<GeolocationProviderMock>(m_context.get());
    378377
     
    436435    WKPageConfigurationSetContext(m_configuration.get(), m_context.get());
    437436    WKPageConfigurationSetPageGroup(m_configuration.get(), m_pageGroup.get());
     437    WKPageConfigurationSetUserContentController(m_configuration.get(), adoptWK(WKUserContentControllerCreate()).get());
    438438
    439439    // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now.
     
    443443void TestController::createWebViewWithOptions(const ViewOptions& options)
    444444{
    445     m_mainWebView = std::make_unique<PlatformWebView>(m_configuration.get(), options);
     445    platformCreateWebView(m_configuration.get(), options);
    446446    WKPageUIClientV6 pageUIClient = {
    447447        { 6, m_mainWebView.get() },
     
    569569{
    570570    // Reset preferences
    571     WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get());
     571    WKPreferencesRef preferences = platformPreferences();
    572572    WKPreferencesResetTestRunnerOverrides(preferences);
    573573    WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(preferences, false);
     
    623623
    624624    WKPreferencesSetAcceleratedDrawingEnabled(preferences, m_shouldUseAcceleratedDrawing);
     625    // FIXME: We should be testing the default.
     626    WKPreferencesSetStorageBlockingPolicy(preferences, kWKAllowAllStorage);
    625627
    626628    WKCookieManagerDeleteAllCookies(WKContextGetCookieManager(m_context.get()));
     
    634636
    635637    m_beforeUnloadReturnValue = true;
     638
     639    // This setting differs between the antique and modern Mac WebKit2 API.
     640    // For now, maintain the antique behavior, because some tests depend on it!
     641    // FIXME: We should be testing the default.
     642    WKPageSetBackgroundExtendsBeyondPage(m_mainWebView->page(), false);
    636643
    637644    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("Reset"));
     
    669676#endif
    670677
    671     // in the case that a test using the chrome input field failed, be sure to clean up for the next test
     678    // In the case that a test using the chrome input field failed, be sure to clean up for the next test.
    672679    m_mainWebView->removeChromeInputField();
    673680    m_mainWebView->focus();
     
    711718    m_shouldLogHistoryClientCallbacks = false;
    712719
    713     WKPageGroupRemoveAllUserContentFilters(WKPageGetPageGroup(m_mainWebView->page()));
    714 
    715720    setHidden(false);
     721
     722    platformResetStateToConsistentValues();
    716723
    717724    // Reset main page back to about:blank
     
    15941601}
    15951602
     1603#if !PLATFORM(COCOA)
     1604void TestController::platformWillRunTest(const TestInvocation&)
     1605{
     1606}
     1607
     1608WKPreferencesRef TestController::platformPreferences()
     1609{
     1610    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageCopyPageConfiguration(m_mainWebView->page()));
     1611    return WKPageConfigurationGetPreferences(configuration.get());
     1612}
     1613
     1614void TestController::platformCreateWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     1615{
     1616    m_mainWebView = std::make_unique<PlatformWebView>(configuration, options);
     1617}
     1618
     1619PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef configuration, const ViewOptions& options)
     1620{
     1621    return new PlatformWebView(configuration, options);
     1622}
     1623
     1624WKContextRef TestController::platformAdjustContext(WKContextRef context, WKContextConfigurationRef contextConfiguration)
     1625{
     1626    return context;
     1627}
     1628
     1629void TestController::platformResetStateToConsistentValues()
     1630{
     1631
     1632}
     1633#endif
     1634
    15961635} // namespace WTR
  • trunk/Tools/WebKitTestRunner/TestController.h

    r188817 r188828  
    3535#include <wtf/Vector.h>
    3636
     37OBJC_CLASS WKWebViewConfiguration;
     38
    3739namespace WTR {
    3840
     
    133135    void platformInitialize();
    134136    void platformDestroy();
     137    WKContextRef platformAdjustContext(WKContextRef, WKContextConfigurationRef);
    135138    void platformInitializeContext();
     139    void platformCreateWebView(WKPageConfigurationRef, const ViewOptions&);
     140    static PlatformWebView* platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const ViewOptions&);
    136141    void platformResetPreferencesToConsistentValues();
     142    void platformResetStateToConsistentValues();
    137143    void platformConfigureViewForTest(const TestInvocation&);
    138144    void platformWillRunTest(const TestInvocation&);
    139145    void platformRunUntil(bool& done, double timeout);
    140146    void platformDidCommitLoadForFrame(WKPageRef, WKFrameRef);
     147    WKPreferencesRef platformPreferences();
    141148    void initializeInjectedBundlePath();
    142149    void initializeTestPluginDirectory();
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r188817 r188828  
    269269
    270270    if (m_dumpPixels && m_pixelResult) {
    271         if (PlatformWebView::windowSnapshotEnabled()) {
    272             m_gotRepaint = false;
    273             WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
    274             TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
    275             if (!m_gotRepaint) {
    276                 m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
    277                 m_webProcessIsUnresponsive = true;
    278                 return;
    279             }
     271        m_gotRepaint = false;
     272        WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
     273        TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
     274        if (!m_gotRepaint) {
     275            m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
     276            m_webProcessIsUnresponsive = true;
     277            return;
    280278        }
    281279        dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get());
  • trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r188817 r188828  
    4141                29A8FCE2145F037B009045A6 /* AccessibilityTextMarkerRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE1145F037B009045A6 /* AccessibilityTextMarkerRange.cpp */; };
    4242                29A8FCE5145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */; };
     43                2DCE2CD31B8452F800C7F832 /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; };
     44                2DCE2CD41B84530A00C7F832 /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; };
    4345                2E34C90018B68808000067BB /* WebKitTestRunnerInjectedBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */; };
    4446                2E63ED8A1891AD7E002A7AFC /* AccessibilityControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */; };
     
    172174                29A8FCE1345E7021006AA5A7 /* JSAccessibilityTextMarkerRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAccessibilityTextMarkerRange.h; path = DerivedSources/WebKitTestRunner/JSAccessibilityTextMarkerRange.h; sourceTree = BUILT_PRODUCTS_DIR; };
    173175                29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityTextMarkerRangeMac.mm; sourceTree = "<group>"; };
     176                2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestControllerCocoa.mm; path = cocoa/TestControllerCocoa.mm; sourceTree = "<group>"; };
    174177                2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityControllerIOS.mm; sourceTree = "<group>"; };
    175178                2E63ED761891ACE9002A7AFC /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityNotificationHandler.h; sourceTree = "<group>"; };
     
    398401                                0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */,
    399402                                0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */,
     403                                2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */,
    400404                        );
    401405                        name = cocoa;
     
    787791                                2E63ED981891ADC7002A7AFC /* TestController.cpp in Sources */,
    788792                                2E63ED921891ADAD002A7AFC /* TestControllerIOS.mm in Sources */,
     793                                2DCE2CD31B8452F800C7F832 /* TestControllerCocoa.mm in Sources */,
    789794                                0FEB90A81905C537000FDBF3 /* CrashReporterInfo.mm in Sources */,
    790795                                2E63ED991891ADC7002A7AFC /* TestInvocation.cpp in Sources */,
     
    806811                                E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */,
    807812                                5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
     813                                2DCE2CD41B84530A00C7F832 /* TestControllerCocoa.mm in Sources */,
    808814                                26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */,
    809815                                BC793400118F7C84005EA8E2 /* main.mm in Sources */,
  • trunk/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp

    r188817 r188828  
    6262
    6363void TestController::platformDestroy()
    64 {
    65 }
    66 
    67 void TestController::platformWillRunTest(const TestInvocation&)
    6864{
    6965}
  • trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp

    r188817 r188828  
    5050
    5151void TestController::platformDestroy()
    52 {
    53 }
    54 
    55 void TestController::platformWillRunTest(const TestInvocation&)
    5652{
    5753}
  • trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm

    r188817 r188828  
    2929
    3030#import <WebKit/WKImageCG.h>
    31 #import <WebKit/WKViewPrivate.h>
    3231#import <WebKit/WKPreferencesPrivate.h>
     32#import <WebKit/WKWebViewConfiguration.h>
     33#import <WebKit/WKWebViewPrivate.h>
    3334#import <wtf/RetainPtr.h>
     35
     36@interface WKWebView (Details)
     37- (WKPageRef)_pageForTesting;
     38@end
    3439
    3540@interface WebKitTestRunnerWindow : UIWindow {
     
    4146@end
    4247
    43 @interface TestRunnerWKView : WKView {
    44     BOOL _useTiledDrawing;
    45 }
    46 
    47 @property (nonatomic, assign) BOOL useTiledDrawing;
    48 @end
    49 
    50 @implementation TestRunnerWKView
    51 
    52 @synthesize useTiledDrawing = _useTiledDrawing;
    53 
    54 - (id)initWithFrame:(CGRect)frame configurationRef:(WKPageConfigurationRef)configuration useTiledDrawing:(BOOL)useTiledDrawing
    55 {
    56     if (!(self = [super initWithFrame:frame configurationRef:configuration]))
    57         return nil;
    58 
    59     _useTiledDrawing = useTiledDrawing;
    60     return self;
    61 }
    62 
    63 - (BOOL)_shouldUseTiledDrawingArea
    64 {
    65     return _useTiledDrawing;
    66 }
    67 
    68 @end
    69 
    7048@implementation WebKitTestRunnerWindow
    7149@synthesize platformWebView = _platformWebView;
     
    123101namespace WTR {
    124102
    125 PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     103PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options)
    126104    : m_windowIsKey(true)
    127105    , m_options(options)
    128106{
    129107    CGRect rect = CGRectMake(0, 0, TestController::viewWidth, TestController::viewHeight);
    130     m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useTiledDrawing:m_options.useTiledDrawing];
    131 
    132     WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration);
    133 
    134     WKPreferencesSetCompositingBordersVisible(WKPageGroupGetPreferences(pageGroupRef), YES);
    135     WKPreferencesSetCompositingRepaintCountersVisible(WKPageGroupGetPreferences(pageGroupRef), YES);
     108    m_view = [[WKWebView alloc] initWithFrame:rect configuration:configuration];
    136109
    137110    CGRect windowRect = rect;
     
    154127{
    155128    m_window.platformWebView = 0;
    156 //    [m_window close];
    157129    [m_view release];
    158130    [m_window release];
     
    161133WKPageRef PlatformWebView::page()
    162134{
    163     return [m_view pageRef];
     135    return [m_view _pageForTesting];
    164136}
    165137
    166138void PlatformWebView::focus()
    167139{
    168 //    [m_window makeFirstResponder:m_view]; // FIXME: iOS equivalent?
     140    makeWebViewFirstResponder();
    169141    setWindowIsKey(true);
    170142}
     
    185157{
    186158    [m_window setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height)];
    187     [m_view setFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
     159    [platformView() setFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
    188160}
    189161
     
    216188void PlatformWebView::makeWebViewFirstResponder()
    217189{
    218 //    [m_window makeFirstResponder:m_view];
     190    // FIXME: iOS equivalent?
     191    // [m_window makeFirstResponder:m_view];
    219192}
    220193
     
    226199WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
    227200{
    228     return 0; // FIXME for iOS?
     201    // FIXME: Need an implementation of this, or we're depending on software paints!
     202    return nullptr;
    229203}
    230204
    231205bool PlatformWebView::viewSupportsOptions(const ViewOptions& options) const
    232206{
    233     if (m_options.useTiledDrawing != options.useTiledDrawing)
    234         return false;
    235 
    236207    return true;
    237208}
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r188817 r188828  
    2727#import "TestController.h"
    2828
    29 #import "CrashReporterInfo.h"
    30 #import <Foundation/Foundation.h>
    3129#import "PlatformWebView.h"
    3230#import "TestInvocation.h"
     31#import <Foundation/Foundation.h>
    3332#import <WebKit/WKPreferencesRefPrivate.h>
     33#import <WebKit/WKProcessPoolPrivate.h>
    3434#import <WebKit/WKStringCF.h>
     35#import <WebKit/WKUserContentControllerPrivate.h>
     36#import <WebKit/WKWebView.h>
     37#import <WebKit/WKWebViewConfiguration.h>
     38#import <WebKit/WKWebViewConfigurationPrivate.h>
    3539#import <wtf/MainThread.h>
    3640
     
    7175}
    7276
    73 void TestController::platformWillRunTest(const TestInvocation& testInvocation)
    74 {
    75     setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
    76 }
    77 
    7877static bool shouldMakeViewportFlexible(const TestInvocation& test)
    7978{
     
    8382void TestController::platformResetPreferencesToConsistentValues()
    8483{
    85     WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get());
     84    WKPreferencesRef preferences = platformPreferences();
    8685    // Note that WKPreferencesSetTextAutosizingEnabled has no effect on iOS.
    8786    WKPreferencesSetMinimumZoomFontSize(preferences, 0);
     
    101100void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const
    102101{
    103 }
    104 
    105 void TestController::platformRunUntil(bool& done, double timeout)
    106 {
    107     NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
    108 
    109     while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)
    110         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
    111102}
    112103
  • trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm

    r188817 r188828  
    3434#import <WebKit/WKString.h>
    3535#import <WebKit/WKPagePrivate.h>
     36#import <WebKit/WKWebView.h>
    3637#import <wtf/RetainPtr.h>
    3738
     
    269270    // The right solution is just to use NSApplication's built-in event sending methods,
    270271    // instead of rolling our own algorithm for selecting an event target.
    271     targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
     272    // FIXME: This is even worse now, because we need to hit the WKWebView's inner WKView
     273    // when using the modern API, so the level of fakery and horror increases.
     274    if (!targetView) {
     275        targetView = m_testController->mainWebView()->platformView();
     276        for (NSView *wkWebViewChild in targetView.subviews) {
     277            if ([wkWebViewChild isKindOfClass:[WKView class]]) {
     278                targetView = wkWebViewChild;
     279                break;
     280            }
     281        }
     282    }
    272283    ASSERT(targetView);
    273284    [NSApp _setCurrentEvent:event];
     
    402413{
    403414    NSView *view = m_testController->mainWebView()->platformView();
    404     NSPoint position = [view convertPoint:NSMakePoint(x, y) toView:nil];
     415    NSPoint position = [view convertPoint:NSMakePoint(x, view.frame.size.height - y) toView:nil];
    405416    m_position.x = position.x;
    406417    m_position.y = position.y;
     
    409420                                   modifierFlags:0
    410421                                       timestamp:absoluteTimeForEventTime(currentEventTime())
    411                                     windowNumber:[[view window] windowNumber]
     422                                    windowNumber:view.window.windowNumber
    412423                                         context:[NSGraphicsContext currentContext]
    413424                                     eventNumber:++eventNumber
    414425                                      clickCount:(m_leftMouseButtonDown ? m_clickCount : 0)
    415                                         pressure:0.0];
    416 
    417     NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]];
     426                                        pressure:0];
     427
     428    NSPoint windowLocation = event.locationInWindow;
     429    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:windowLocation];
    418430    if (targetView) {
    419431        [NSApp _setCurrentEvent:event];
    420432        [targetView mouseMoved:event];
    421433        [NSApp _setCurrentEvent:nil];
    422     } else {
    423         NSPoint windowLocation = [event locationInWindow];
     434    } else
    424435        WTFLogAlways("mouseMoveTo failed to find a target view at %f,%f\n", windowLocation.x, windowLocation.y);
    425     }
    426436}
    427437
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r188817 r188828  
    3131#import <WebKit/WKImageCG.h>
    3232#import <WebKit/WKPreferencesPrivate.h>
    33 #import <WebKit/WKViewPrivate.h>
     33#import <WebKit/WKWebViewConfiguration.h>
     34#import <WebKit/WKWebViewPrivate.h>
    3435#import <wtf/RetainPtr.h>
     36
     37#if WK_API_ENABLED
     38@interface WKWebView (Details)
     39- (WKPageRef)_pageForTesting;
     40@end
     41#endif
    3542
    3643using namespace WTR;
     
    4754@end
    4855
    49 @interface TestRunnerWKView : WKView {
    50     BOOL _useThreadedScrolling;
    51 }
    52 
    53 @property (nonatomic, assign) BOOL useThreadedScrolling;
    54 @end
    55 
    56 @implementation TestRunnerWKView
    57 
    58 @synthesize useThreadedScrolling = _useThreadedScrolling;
    59 
    60 - (id)initWithFrame:(NSRect)frame configurationRef:(WKPageConfigurationRef)configuration useThreadedScrolling:(BOOL)useThreadedScrolling
    61 {
    62     if (!(self = [super initWithFrame:frame configurationRef:configuration]))
    63         return nil;
    64 
    65     _useThreadedScrolling = useThreadedScrolling;
    66     return self;
    67 }
     56#if WK_API_ENABLED
     57@interface TestRunnerWKWebView : WKWebView
     58@end
     59
     60@implementation TestRunnerWKWebView
    6861
    6962- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
     
    7467
    7568@end
     69#endif
    7670
    7771@implementation WebKitTestRunnerWindow
     
    121115namespace WTR {
    122116
    123 PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     117PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options)
    124118    : m_windowIsKey(true)
    125119    , m_options(options)
    126120{
    127     WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration);
    128 
    129     // The tiled drawing specific tests also depend on threaded scrolling.
    130     WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroupRef);
    131     WKPreferencesSetThreadedScrollingEnabled(preferences, m_options.useThreadedScrolling);
    132 
     121#if WK_API_ENABLED
    133122    // FIXME: Not sure this is the best place for this; maybe we should have API to set this so we can do it from TestController?
    134123    if (m_options.useRemoteLayerTree)
    135124        [[NSUserDefaults standardUserDefaults] setValue:@YES forKey:@"WebKit2UseRemoteLayerTreeDrawingArea"];
    136125
     126    RetainPtr<WKWebViewConfiguration> copiedConfiguration = adoptNS([configuration copy]);
     127    WKPreferencesSetThreadedScrollingEnabled((WKPreferencesRef)[copiedConfiguration preferences], m_options.useThreadedScrolling);
     128
    137129    NSRect rect = NSMakeRect(0, 0, TestController::viewWidth, TestController::viewHeight);
    138     m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useThreadedScrolling:options.useThreadedScrolling];
    139     [m_view setWindowOcclusionDetectionEnabled:NO];
     130    m_view = [[TestRunnerWKWebView alloc] initWithFrame:rect configuration:copiedConfiguration.get()];
     131    [m_view _setWindowOcclusionDetectionEnabled:NO];
    140132
    141133    NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
     
    151143        [m_window orderBack:nil];
    152144    [m_window setReleasedWhenClosed:NO];
     145#endif
    153146}
    154147
     
    171164WKPageRef PlatformWebView::page()
    172165{
    173     return [m_view pageRef];
     166#if WK_API_ENABLED
     167    return [m_view _pageForTesting];
     168#else
     169    return nullptr;
     170#endif
    174171}
    175172
    176173void PlatformWebView::focus()
    177174{
    178     [m_window makeFirstResponder:m_view];
     175    [m_window makeFirstResponder:platformView()];
    179176    setWindowIsKey(true);
    180177}
     
    195192{
    196193    [m_window setFrame:NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height) display:YES];
    197     [m_view setFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)];
     194    [platformView() setFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)];
    198195}
    199196
     
    206203void PlatformWebView::addChromeInputField()
    207204{
    208     NSTextField* textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)];
     205    NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)];
    209206    textField.tag = 1;
    210207    [[m_window contentView] addSubview:textField];
    211208    [textField release];
    212209
    213     [textField setNextKeyView:m_view];
    214     [m_view setNextKeyView:textField];
     210    NSView *view = platformView();
     211    [textField setNextKeyView:view];
     212    [view setNextKeyView:textField];
    215213}
    216214
    217215void PlatformWebView::removeChromeInputField()
    218216{
    219     NSView* textField = [[m_window contentView] viewWithTag:1];
     217    NSView *textField = [[m_window contentView] viewWithTag:1];
    220218    if (textField) {
    221219        [textField removeFromSuperview];
     
    226224void PlatformWebView::makeWebViewFirstResponder()
    227225{
    228     [m_window makeFirstResponder:m_view];
     226    [m_window makeFirstResponder:platformView()];
    229227}
    230228
    231229WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
    232230{
    233     [m_view display];
     231    [platformView() display];
    234232    CGWindowImageOption options = kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque;
    235233
  • trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm

    r188817 r188828  
    2727#import "TestController.h"
    2828
    29 #import "CrashReporterInfo.h"
    3029#import "PlatformWebView.h"
    3130#import "PoseAsClass.h"
     
    3433#import <WebKit/WKContextPrivate.h>
    3534#import <WebKit/WKPageGroup.h>
     35#import <WebKit/WKProcessPoolPrivate.h>
    3636#import <WebKit/WKStringCF.h>
    3737#import <WebKit/WKURLCF.h>
     38#import <WebKit/WKUserContentControllerPrivate.h>
     39#import <WebKit/WKWebView.h>
     40#import <WebKit/WKWebViewConfiguration.h>
     41#import <WebKit/WKWebViewConfigurationPrivate.h>
    3842#import <WebKit/_WKUserContentExtensionStore.h>
    3943#import <WebKit/_WKUserContentExtensionStorePrivate.h>
     
    7478}
    7579
    76 void TestController::platformWillRunTest(const TestInvocation& testInvocation)
    77 {
    78     setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
    79 }
    80 
    8180static bool shouldUseThreadedScrolling(const TestInvocation& test)
    8281{
     
    8685void TestController::platformResetPreferencesToConsistentValues()
    8786{
    88 #if WK_API_ENABLED
    89     __block bool doneRemoving = false;
    90     [[_WKUserContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestContentExtensions" completionHandler:^(NSError *error)
    91     {
    92         doneRemoving = true;
    93     }];
    94     platformRunUntil(doneRemoving, 0);
    95     [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];
    96 #endif
    9787}
    9888
     
    122112    {
    123113        if (!error)
    124             WKPageGroupAddUserContentFilter(WKPageGetPageGroup(TestController::singleton().mainWebView()->page()), (__bridge WKUserContentFilterRef)filter);
     114            [mainWebView()->platformView().configuration.userContentController _addUserContentFilter:filter];
    125115        else
    126116            NSLog(@"%@", [error helpAnchor]);
     
    129119    platformRunUntil(doneCompiling, 0);
    130120#endif
    131 }
    132 
    133 void TestController::platformRunUntil(bool& done, double timeout)
    134 {
    135     NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
    136 
    137     while (!done && [endDate compare:[NSDate date]] == NSOrderedDescending)
    138         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
    139121}
    140122
Note: See TracChangeset for help on using the changeset viewer.