Bug 163406

Summary: Add test and infrastructure for link popover
Product: WebKit Reporter: Megan Gardner <megan_gardner>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, megan_gardner, simon.fraser, thorton, wenson_hsieh
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Megan Gardner 2016-10-13 15:11:34 PDT
Add test and infrastructure for link popover
Comment 1 Megan Gardner 2016-10-13 15:30:45 PDT
Created attachment 291526 [details]
Patch
Comment 2 Simon Fraser (smfr) 2016-10-13 16:15:59 PDT
Comment on attachment 291526 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291526&action=review

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:26
> +#pragma once

Don't add this, since Obj-C's #import already takes care of this.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:274
> +- (void)didShowForcePressPreview WK_API_AVAILABLE(ios(WK_IOS_TBA));
> +- (void)didDismissForcePressPreview WK_API_AVAILABLE(ios(WK_IOS_TBA));

These should have leading underscores ("_didShowForcePressPreview")  - the others need fixing too.

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:3851
> +    if ([userInterfaceItem isEqualToString:@"popoverContents"]) {

Blank line above please.

> Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:125
> +    // Preview form handling

Maybe "Force press preview handling"

> Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h:26
> +#pragma once

No need.

> LayoutTests/ChangeLog:9
> +        * fast/events/touch/ios/iphone7/force-press-on-link-expected.txt: Added.
> +        * fast/events/touch/ios/iphone7/force-press-on-link.html: Added.

Does the popover go away when this test is complete?

> LayoutTests/fast/events/touch/ios/iphone7/force-press-on-link.html:96
> +    <a href="http://www.apple.com">Link Test</a>

This should be a local URL, rather than loading a live web site.
Comment 3 Megan Gardner 2016-10-17 15:07:54 PDT
Created attachment 291882 [details]
Patch
Comment 4 WebKit Commit Bot 2016-10-17 15:10:18 PDT
Attachment 291882 [details] did not pass style-queue:


ERROR: Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h:0:  Use #pragma once header guard.  [build/header_guard] [5]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:0:  Use #pragma once header guard.  [build/header_guard] [5]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Simon Fraser (smfr) 2016-10-17 15:14:15 PDT
Comment on attachment 291882 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291882&action=review

Good patch, but the test needs tweaking.

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:3852
> +    if ([userInterfaceItem isEqualToString:@"popoverContents"]) {

@"popoverContents" seems a bit too generic; I think it should be @"linkPreviewPopoverURL" or something.

> LayoutTests/fast/events/touch/ios/iphone7/force-press-on-link.html:56
> +                    uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('popoverContents')));
> +                    uiController.liftUpAtPoint(20,40,1,function() {});

This is racey. In the uiController.uiScriptComplete() callback, the web process does testRunner.notifyDone(), so may start moving onto the next test.

What you should do instead is have a second testRunner.runUIScript() below, have that fire the uiController.liftUpAtPoint(), and only notifyDone() when that second one completes.
Comment 6 Megan Gardner 2016-10-17 17:17:52 PDT
Created attachment 291900 [details]
Patch
Comment 7 WebKit Commit Bot 2016-10-17 17:19:01 PDT
Attachment 291900 [details] did not pass style-queue:


ERROR: Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h:0:  Use #pragma once header guard.  [build/header_guard] [5]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:0:  Use #pragma once header guard.  [build/header_guard] [5]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Simon Fraser (smfr) 2016-10-17 17:28:56 PDT
Comment on attachment 291900 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291900&action=review

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:3854
> +        return @{ userInterfaceItem: @{@"pageURL": url}};

Perferred spacing here would be:
@{ userInterfaceItem: @{ @"pageURL": url } };

> LayoutTests/fast/events/touch/ios/iphone7/force-press-on-link.html:65
> +                uiController.liftUpAtPoint(20,40,1,function() {

Spaces after commas please.

> LayoutTests/fast/events/touch/ios/iphone7/force-press-on-link.html:87
> +                        document.getElementById('target').innerHTML = output;

I think it's OK to do this before this testRunner.runUIScript() invocation.
Comment 9 Megan Gardner 2016-10-17 17:39:09 PDT
Created attachment 291904 [details]
Patch
Comment 10 WebKit Commit Bot 2016-10-17 17:41:28 PDT
Attachment 291904 [details] did not pass style-queue:


ERROR: Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h:0:  Use #pragma once header guard.  [build/header_guard] [5]
ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:0:  Use #pragma once header guard.  [build/header_guard] [5]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 WebKit Commit Bot 2016-10-17 18:11:07 PDT
Comment on attachment 291904 [details]
Patch

Clearing flags on attachment: 291904

Committed r207447: <http://trac.webkit.org/changeset/207447>
Comment 12 WebKit Commit Bot 2016-10-17 18:11:11 PDT
All reviewed patches have been landed.  Closing bug.