Title: [225332] trunk/Tools
- Revision
- 225332
- Author
- wenson_hs...@apple.com
- Date
- 2017-11-30 10:58:06 -0800 (Thu, 30 Nov 2017)
Log Message
WKAttachmentTests.InPlaceImageAttachmentToggleDisplayMode times out on macOS bots
https://bugs.webkit.org/show_bug.cgi?id=180200
Reviewed by Alexey Proskuryakov.
Rewrites an API test to avoid checking against the hard-coded platform-dependent size of an attachment element.
Instead, first insert the attachment element as an icon and compute its size, and then check that the size of
the element is restored to this original value after toggling the display mode to in-place mode and back.
* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(-[TestWKWebView attachmentElementSize]):
(-[TestWKWebView waitForAttachmentElementSizeToBecome:]):
(TestWebKitAPI::TEST):
(platformAttachmentIconElementSize): Deleted.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (225331 => 225332)
--- trunk/Tools/ChangeLog 2017-11-30 18:17:07 UTC (rev 225331)
+++ trunk/Tools/ChangeLog 2017-11-30 18:58:06 UTC (rev 225332)
@@ -1,3 +1,20 @@
+2017-11-30 Wenson Hsieh <wenson_hs...@apple.com>
+
+ WKAttachmentTests.InPlaceImageAttachmentToggleDisplayMode times out on macOS bots
+ https://bugs.webkit.org/show_bug.cgi?id=180200
+
+ Reviewed by Alexey Proskuryakov.
+
+ Rewrites an API test to avoid checking against the hard-coded platform-dependent size of an attachment element.
+ Instead, first insert the attachment element as an icon and compute its size, and then check that the size of
+ the element is restored to this original value after toggling the display mode to in-place mode and back.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+ (-[TestWKWebView attachmentElementSize]):
+ (-[TestWKWebView waitForAttachmentElementSizeToBecome:]):
+ (TestWebKitAPI::TEST):
+ (platformAttachmentIconElementSize): Deleted.
+
2017-11-30 Michael Catanzaro <mcatanz...@igalia.com>
[WPE] Stop building Wayland in JHBuild moduleset
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (225331 => 225332)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm 2017-11-30 18:17:07 UTC (rev 225331)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm 2017-11-30 18:58:06 UTC (rev 225332)
@@ -34,15 +34,6 @@
#if WK_API_ENABLED
-CGSize platformAttachmentIconElementSize()
-{
-#if PLATFORM(IOS)
- return CGSizeMake(160, 119);
-#else
- return CGSizeMake(61, 89);
-#endif
-}
-
@interface AttachmentUpdateObserver : NSObject <WKUIDelegatePrivate>
@property (nonatomic, readonly) NSArray *inserted;
@property (nonatomic, readonly) NSArray *removed;
@@ -192,18 +183,22 @@
return attachment.autorelease();
}
+- (CGSize)attachmentElementSize
+{
+ __block CGSize size;
+ __block bool doneEvaluatingScript = false;
+ [self evaluateJavaScript:@"r = document.querySelector('attachment').getBoundingClientRect(); [r.width, r.height]" completionHandler:^(NSArray<NSNumber *> *sizeResult, NSError *) {
+ size = CGSizeMake(sizeResult.firstObject.floatValue, sizeResult.lastObject.floatValue);
+ doneEvaluatingScript = true;
+ }];
+ TestWebKitAPI::Util::run(&doneEvaluatingScript);
+ return size;
+}
+
- (void)waitForAttachmentElementSizeToBecome:(CGSize)expectedSize
{
while ([[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]) {
- __block bool doneEvaluatingScript = false;
- __block BOOL sizeIsEqual = NO;
- [self evaluateJavaScript:@"r = document.querySelector('attachment').getBoundingClientRect(); [r.width, r.height]" completionHandler:^(NSArray<NSNumber *> *sizeResult, NSError *) {
- CGSize observedSize { sizeResult.firstObject.floatValue, sizeResult.lastObject.floatValue };
- sizeIsEqual = CGSizeEqualToSize(expectedSize, observedSize);
- doneEvaluatingScript = true;
- }];
- TestWebKitAPI::Util::run(&doneEvaluatingScript);
- if (sizeIsEqual)
+ if (CGSizeEqualToSize(self.attachmentElementSize, expectedSize))
break;
}
}
@@ -499,15 +494,19 @@
RetainPtr<_WKAttachment> attachment;
{
ObserveAttachmentUpdatesForScope observer(webView.get());
- attachment = retainPtr([webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:imageData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]);
+ attachment = retainPtr([webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:imageData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon)]);
+ [attachment expectRequestedDataToBe:imageData.get()];
observer.expectAttachmentUpdates(@[], @[attachment.get()]);
- [attachment expectRequestedDataToBe:imageData.get()];
- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)];
}
+ CGSize iconAttachmentSize = [webView attachmentElementSize];
+ [attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace) error:nil];
+ [attachment expectRequestedDataToBe:imageData.get()];
+ [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)];
+
[attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon) error:nil];
[attachment expectRequestedDataToBe:imageData.get()];
- [webView waitForAttachmentElementSizeToBecome:platformAttachmentIconElementSize()];
+ [webView waitForAttachmentElementSizeToBecome:iconAttachmentSize];
[attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace) error:nil];
[attachment expectRequestedDataToBe:imageData.get()];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes