| Differences between
and this patch
- a/Tools/ChangeLog +23 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2020-04-22  Jer Noble  <jer.noble@apple.com>
2
3
        REGRESSION (r260278): TestWebKitAPI.Fullscreen.Delegate is timing out on macOS bots
4
        https://bugs.webkit.org/show_bug.cgi?id=210676
5
        <rdar://problem/61953702>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        A number of API tests modify the WKWebViewConfiguration after calling -[WKWebView initWithFrame:configuration:], which
10
        could be a source of failures or flakiness. Update these tests to set those configuration values before passing the
11
        configuration to WKWebView.
12
13
        * TestWebKitAPI/Tests/WebKitCocoa/FullscreenAlert.mm:
14
        (TestWebKitAPI::TEST):
15
        * TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm:
16
        (TestWebKitAPI::TEST):
17
        * TestWebKitAPI/Tests/WebKitCocoa/FullscreenLayoutConstraints.mm:
18
        (TestWebKitAPI::TEST):
19
        * TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.mm:
20
        (TestWebKitAPI::TEST):
21
        * TestWebKitAPI/Tests/WebKitCocoa/TopContentInset.mm:
22
        (TestWebKitAPI::TEST):
23
1
2020-04-22  Alex Christensen  <achristensen@webkit.org>
24
2020-04-22  Alex Christensen  <achristensen@webkit.org>
2
25
3
        Add unit test for resuming downloads
26
        Add unit test for resuming downloads
- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenAlert.mm -1 / +1 lines
Lines 41-48 static bool isOutOfFullscreen = false; a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenAlert.mm_sec1
41
TEST(Fullscreen, Alert)
41
TEST(Fullscreen, Alert)
42
{
42
{
43
    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
43
    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
44
    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
45
    [configuration preferences]._fullScreenEnabled = YES;
44
    [configuration preferences]._fullScreenEnabled = YES;
45
    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
46
46
47
    auto checkFullscreen = [&] {
47
    auto checkFullscreen = [&] {
48
        isInFullscreen = [webView _isInFullscreen];
48
        isInFullscreen = [webView _isInFullscreen];
- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm -1 / +1 lines
Lines 85-92 namespace TestWebKitAPI { a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenDelegate.mm_sec1
85
TEST(Fullscreen, Delegate)
85
TEST(Fullscreen, Delegate)
86
{
86
{
87
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
87
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
88
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
89
    [configuration preferences]._fullScreenEnabled = YES;
88
    [configuration preferences]._fullScreenEnabled = YES;
89
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
90
    RetainPtr<FullscreenDelegateMessageHandler> handler = adoptNS([[FullscreenDelegateMessageHandler alloc] init]);
90
    RetainPtr<FullscreenDelegateMessageHandler> handler = adoptNS([[FullscreenDelegateMessageHandler alloc] init]);
91
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenChangeHandler"];
91
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenChangeHandler"];
92
    [webView _setFullscreenDelegate:handler.get()];
92
    [webView _setFullscreenDelegate:handler.get()];
- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenLayoutConstraints.mm -1 / +1 lines
Lines 55-62 namespace TestWebKitAPI { a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenLayoutConstraints.mm_sec1
55
TEST(Fullscreen, LayoutConstraints)
55
TEST(Fullscreen, LayoutConstraints)
56
{
56
{
57
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
57
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
58
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
59
    [configuration preferences]._fullScreenEnabled = YES;
58
    [configuration preferences]._fullScreenEnabled = YES;
59
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
60
    RetainPtr<FullscreenStateChangeMessageHandler> handler = adoptNS([[FullscreenStateChangeMessageHandler alloc] init]);
60
    RetainPtr<FullscreenStateChangeMessageHandler> handler = adoptNS([[FullscreenStateChangeMessageHandler alloc] init]);
61
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenStateChangeHandler"];
61
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenStateChangeHandler"];
62
62
- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.mm -1 / +2 lines
Lines 112-122 namespace TestWebKitAPI { a/Tools/TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.mm_sec1
112
TEST(PictureInPicture, WKUIDelegate)
112
TEST(PictureInPicture, WKUIDelegate)
113
{
113
{
114
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
114
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
115
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 640, 480) configuration:configuration.get()]);
116
    [configuration preferences]._fullScreenEnabled = YES;
115
    [configuration preferences]._fullScreenEnabled = YES;
117
    [configuration preferences]._allowsPictureInPictureMediaPlayback = YES;
116
    [configuration preferences]._allowsPictureInPictureMediaPlayback = YES;
118
    RetainPtr<PictureInPictureUIDelegate> handler = adoptNS([[PictureInPictureUIDelegate alloc] init]);
117
    RetainPtr<PictureInPictureUIDelegate> handler = adoptNS([[PictureInPictureUIDelegate alloc] init]);
119
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"pictureInPictureChangeHandler"];
118
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"pictureInPictureChangeHandler"];
119
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 640, 480) configuration:configuration.get()]);
120
120
    [webView setUIDelegate:handler.get()];
121
    [webView setUIDelegate:handler.get()];
121
122
122
#if HAVE(TOUCH_BAR)
123
#if HAVE(TOUCH_BAR)
- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/TopContentInset.mm -3 / +3 lines
Lines 56-67 namespace TestWebKitAPI { a/Tools/TestWebKitAPI/Tests/WebKitCocoa/TopContentInset.mm_sec1
56
TEST(TopContentInset, Fullscreen)
56
TEST(TopContentInset, Fullscreen)
57
{
57
{
58
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
58
    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
59
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
60
    [webView _setTopContentInset:10];
61
    [webView _setAutomaticallyAdjustsContentInsets:NO];
62
    [configuration preferences]._fullScreenEnabled = YES;
59
    [configuration preferences]._fullScreenEnabled = YES;
63
    RetainPtr<FullscreenChangeMessageHandler> handler = adoptNS([[FullscreenChangeMessageHandler alloc] init]);
60
    RetainPtr<FullscreenChangeMessageHandler> handler = adoptNS([[FullscreenChangeMessageHandler alloc] init]);
64
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenChangeHandler"];
61
    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenChangeHandler"];
62
    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
63
    [webView _setTopContentInset:10];
64
    [webView _setAutomaticallyAdjustsContentInsets:NO];
65
65
66
    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]);
66
    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]);
67
    [[window contentView] addSubview:webView.get()];
67
    [[window contentView] addSubview:webView.get()];

Return to Bug 210676