Modified: trunk/Tools/ChangeLog (226934 => 226935)
--- trunk/Tools/ChangeLog 2018-01-13 04:09:43 UTC (rev 226934)
+++ trunk/Tools/ChangeLog 2018-01-13 05:30:57 UTC (rev 226935)
@@ -1,3 +1,17 @@
+2018-01-12 Wenson Hsieh <[email protected]>
+
+ [macOS] API tests ChangeAttachmentDataUpdatesWithInPlaceDisplay and InPlaceVideoAttachmentInsertionWithinList are failing
+ https://bugs.webkit.org/show_bug.cgi?id=181626
+
+ Reviewed by Joseph Pecoraro.
+
+ Make the web view for WKAttachmentTests slightly bigger to avoid size clamping behavior introduced in r226915.
+ Additionally, write a new API test covering the change in r226915.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+ (webViewForTestingAttachments):
+ (TestWebKitAPI::TEST):
+
2018-01-12 Alex Christensen <[email protected]>
History state should be updated during client redirects with asynchronous policy decisions
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (226934 => 226935)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm 2018-01-13 04:09:43 UTC (rev 226934)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm 2018-01-13 05:30:57 UTC (rev 226935)
@@ -126,18 +126,23 @@
@interface TestWKWebView (AttachmentTesting)
@end
-static RetainPtr<TestWKWebView> webViewForTestingAttachments()
+static RetainPtr<TestWKWebView> webViewForTestingAttachments(CGSize webViewSize)
{
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
[configuration _setAttachmentElementEnabled:YES];
WKPreferencesSetCustomPasteboardDataEnabled((WKPreferencesRef)[configuration preferences], YES);
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]);
- [webView synchronouslyLoadHTMLString:@"<script>focus = () => document.body.focus()</script><body _onload_=focus() contenteditable></body>"];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, webViewSize.width, webViewSize.height) configuration:configuration.get()]);
+ [webView synchronouslyLoadHTMLString:@"<meta name='viewport' content='width=device-width, initial-scale=1'><script>focus = () => document.body.focus()</script><body _onload_=focus() contenteditable></body>"];
return webView;
}
+static RetainPtr<TestWKWebView> webViewForTestingAttachments()
+{
+ return webViewForTestingAttachments(CGSizeMake(500, 500));
+}
+
static NSData *testZIPData()
{
NSURL *zipFileURL = [[NSBundle mainBundle] URLForResource:@"compressed-files" withExtension:@"zip" subdirectory:@"TestWebKitAPI.resources"];
@@ -666,6 +671,20 @@
[attachment expectRequestedDataToBe:nil];
}
+TEST(WKAttachmentTests, InsertedImageSizeIsClampedByMaxWidth)
+{
+ auto webView = webViewForTestingAttachments(CGSizeMake(100, 100));
+ RetainPtr<NSData> imageData = testImageData();
+ RetainPtr<_WKAttachment> attachment;
+ {
+ ObserveAttachmentUpdatesForScope observer(webView.get());
+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:imageData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)];
+ [attachment expectRequestedDataToBe:imageData.get()];
+ observer.expectAttachmentUpdates(@[], @[attachment.get()]);
+ }
+ [webView waitForAttachmentElementSizeToBecome:CGSizeMake(84, 67)];
+}
+
TEST(WKAttachmentTests, MultipleSimultaneousAttachmentDataRequests)
{
auto webView = webViewForTestingAttachments();
@@ -1372,7 +1391,7 @@
[webView expectElementTag:@"ATTACHMENT" toComeBefore:@"STRONG"];
auto draggingSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
- [draggingSimulator runFrom:CGPointMake(25, 25) to:CGPointMake(25, 125)];
+ [draggingSimulator runFrom:CGPointMake(25, 25) to:CGPointMake(25, 425)];
attachment = [[draggingSimulator insertedAttachments] firstObject];
[attachment expectRequestedDataToBe:data.get()];
@@ -1401,7 +1420,7 @@
[webView expectElementTag:@"ATTACHMENT" toComeBefore:@"STRONG"];
auto draggingSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
- [draggingSimulator runFrom:CGPointMake(25, 25) to:CGPointMake(25, 125)];
+ [draggingSimulator runFrom:CGPointMake(25, 25) to:CGPointMake(25, 425)];
attachment = [[draggingSimulator insertedAttachments] firstObject];
[attachment expectRequestedDataToBe:data.get()];