Changeset 277508 in webkit


Ignore:
Timestamp:
May 14, 2021, 3:18:06 PM (4 years ago)
Author:
Jean-Yves Avenard
Message:

TestWebKitAPI.Fullscreen.WKViewDelegate is timing out
https://bugs.webkit.org/show_bug.cgi?id=223282
rdar://75495585

Reviewed by Jer Noble.

  • TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm:

(TestWebKitAPI::TEST): Use WkView/NSWindow directly instead of using a
PlatformWebView. A PlatformWebView uses an OffscreenWindow which is a
NSWindow placed with a -10000 offset. This configuration appears to fail
to go into full screen in automation.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r277506 r277508  
     12021-05-14  Jean-Yves Avenard  <jya@apple.com>
     2
     3        TestWebKitAPI.Fullscreen.WKViewDelegate is timing out
     4        https://bugs.webkit.org/show_bug.cgi?id=223282
     5        rdar://75495585
     6
     7        Reviewed by Jer Noble.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm:
     10        (TestWebKitAPI::TEST): Use WkView/NSWindow directly instead of using a
     11        PlatformWebView. A PlatformWebView uses an OffscreenWindow which is a
     12        NSWindow placed with a -10000 offset. This configuration appears to fail
     13        to go into full screen in automation.
     14
    1152021-05-14  Sam Weinig  <weinig@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm

    r274572 r277508  
    2929
    3030#import "PlatformUtilities.h"
    31 #import "PlatformWebView.h"
    3231#import <WebKit/WKPagePrivateMac.h>
    3332#import <WebKit/WKPreferencesPrivate.h>
    3433#import <WebKit/WKView.h>
     34#import <WebKit/WKViewPrivate.h>
    3535#import <WebKit/WKWebViewConfigurationPrivate.h>
    3636#import <WebKit/WKWebViewPrivate.h>
     
    115115}
    116116
    117 // FIXME: Re-enable this test once webkit.org/b/223282 is resolved
    118 TEST(Fullscreen, DISABLED_WKViewDelegate)
     117TEST(Fullscreen, WKViewDelegate)
    119118{
    120119    WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreateWithConfiguration(nullptr));
     
    123122    WKPreferencesSetFullScreenEnabled(preferences, true);
    124123
    125     PlatformWebView webView(context.get(), pageGroup.get());
     124    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate());
     125    WKPageConfigurationSetContext(configuration.get(), context.get());
     126    WKPageConfigurationSetPageGroup(configuration.get(), pageGroup.get());
     127
     128    NSRect rect = NSMakeRect(0, 0, 800, 600);
     129    auto webView = adoptNS([[WKView alloc] initWithFrame:rect configurationRef:configuration.get()]);
     130    [webView setWindowOcclusionDetectionEnabled:NO];
     131
     132    auto window = adoptNS([[NSWindow alloc] initWithContentRect:rect styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]);
     133    [[window contentView] addSubview:webView.get()];
     134    [window makeKeyAndOrderFront:nil];
    126135
    127136    RetainPtr<FullscreenDelegateMessageHandler> handler = adoptNS([[FullscreenDelegateMessageHandler alloc] init]);
    128     WKPageSetFullscreenDelegate(webView.page(), handler.get());
     137    WKPageSetFullscreenDelegate([webView pageRef], handler.get());
    129138
    130139    WKPageNavigationClientV0 loaderClient;
     
    133142    loaderClient.base.version = 0;
    134143    loaderClient.didFinishNavigation = didFinishNavigation;
    135     WKPageSetPageNavigationClient(webView.page(), &loaderClient.base);
     144    WKPageSetPageNavigationClient([webView pageRef], &loaderClient.base);
    136145
    137146    receivedLoadedMessage = false;
    138147    WKRetainPtr<WKURLRef> url = adoptWK(Util::createURLForResource("FullscreenDelegate", "html"));
    139     WKPageLoadURL(webView.page(), url.get());
     148    WKPageLoadURL([webView pageRef], url.get());
    140149
    141150    TestWebKitAPI::Util::run(&receivedLoadedMessage);
    142151
    143     webView.simulateButtonClick(kWKEventMouseButtonLeftButton, 5, 5, 0);
     152    NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDown location:NSMakePoint(5, 5) modifierFlags:0 timestamp:0 windowNumber:window.get().windowNumber context:0 eventNumber:0 clickCount:0 pressure:0];
     153
     154    [webView mouseDown:event];
    144155    TestWebKitAPI::Util::run(&receivedWillEnterFullscreenMessage);
    145156    TestWebKitAPI::Util::run(&receivedDidEnterFullscreenMessage);
    146157
    147     webView.simulateButtonClick(kWKEventMouseButtonLeftButton, 5, 5, 0);
     158    [webView mouseDown:event];
    148159    TestWebKitAPI::Util::run(&receivedWillExitFullscreenMessage);
    149160    TestWebKitAPI::Util::run(&receivedDidExitFullscreenMessage);
Note: See TracChangeset for help on using the changeset viewer.