Modified: trunk/Tools/ChangeLog (242215 => 242216)
--- trunk/Tools/ChangeLog 2019-02-28 20:48:50 UTC (rev 242215)
+++ trunk/Tools/ChangeLog 2019-02-28 20:52:49 UTC (rev 242216)
@@ -1,3 +1,19 @@
+2019-02-28 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Several PasteImage API tests are flaky
+ https://bugs.webkit.org/show_bug.cgi?id=195160
+
+ Reviewed by Tim Horton.
+
+ Some of these tests, such as PasteTIFFImage, don't wait for the inserted image element to finish loading before
+ querying the image element's size; a few other tests, such as PastePNGFile, are racy since they may begin
+ listening for a "load" event after image load is already complete.
+
+ To address this, make these tests first register a "load" event handler, then run script to insert an image
+ element into the document, and finally wait until the load event is observed before checking image size.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/PasteImage.mm:
+
2019-02-28 Chris Dumez <cdu...@apple.com>
Flaky API Test: TestWebKitAPI.ProcessSwap.PageZoomLevelAfterSwap
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteImage.mm (242215 => 242216)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteImage.mm 2019-02-28 20:48:50 UTC (rev 242215)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteImage.mm 2019-02-28 20:52:49 UTC (rev 242216)
@@ -160,8 +160,7 @@
EXPECT_WK_STREQ("sunset-in-cupertino-400px.gif", [webView stringByEvaluatingJavaScript:@"file.name"]);
EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"editor.textContent"]);
- [webView stringByEvaluatingJavaScript:@"insertFileAsImage(file)"];
- [webView waitForMessage:@"loaded"];
+ [webView waitForMessage:@"loaded" afterEvaluatingScript:@"insertFileAsImage(file)"];
EXPECT_WK_STREQ("blob:", [webView stringByEvaluatingJavaScript:@"url = "" URL(imageElement.src); url.protocol"]);
EXPECT_WK_STREQ("400", [webView stringByEvaluatingJavaScript:@"imageElement.width"]);
}
@@ -182,8 +181,7 @@
EXPECT_WK_STREQ("sunset-in-cupertino-600px.jpg", [webView stringByEvaluatingJavaScript:@"file.name"]);
EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"editor.textContent"]);
- [webView stringByEvaluatingJavaScript:@"insertFileAsImage(file)"];
- [webView waitForMessage:@"loaded"];
+ [webView waitForMessage:@"loaded" afterEvaluatingScript:@"insertFileAsImage(file)"];
EXPECT_WK_STREQ("blob:", [webView stringByEvaluatingJavaScript:@"url = "" URL(imageElement.src); url.protocol"]);
EXPECT_WK_STREQ("600", [webView stringByEvaluatingJavaScript:@"imageElement.width"]);
}
@@ -204,8 +202,7 @@
EXPECT_WK_STREQ("sunset-in-cupertino-200px.png", [webView stringByEvaluatingJavaScript:@"file.name"]);
EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"editor.textContent"]);
- [webView stringByEvaluatingJavaScript:@"insertFileAsImage(file)"];
- [webView waitForMessage:@"loaded"];
+ [webView waitForMessage:@"loaded" afterEvaluatingScript:@"insertFileAsImage(file)"];
EXPECT_WK_STREQ("blob:", [webView stringByEvaluatingJavaScript:@"url = "" URL(imageElement.src); url.protocol"]);
EXPECT_WK_STREQ("200", [webView stringByEvaluatingJavaScript:@"imageElement.width"]);
}
@@ -226,8 +223,7 @@
EXPECT_WK_STREQ("sunset-in-cupertino-100px.tiff", [webView stringByEvaluatingJavaScript:@"file.name"]);
EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"editor.textContent"]);
- [webView stringByEvaluatingJavaScript:@"insertFileAsImage(file)"];
- [webView waitForMessage:@"loaded"];
+ [webView waitForMessage:@"loaded" afterEvaluatingScript:@"insertFileAsImage(file)"];
EXPECT_WK_STREQ("blob:", [webView stringByEvaluatingJavaScript:@"url = "" URL(imageElement.src); url.protocol"]);
EXPECT_WK_STREQ("100", [webView stringByEvaluatingJavaScript:@"imageElement.width"]);
}
@@ -248,7 +244,7 @@
EXPECT_WK_STREQ("image/png", [webView stringByEvaluatingJavaScript:@"file = dataTransfer.files[0]; file.type"]);
EXPECT_WK_STREQ("image.png", [webView stringByEvaluatingJavaScript:@"file.name"]);
- [webView stringByEvaluatingJavaScript:@"insertFileAsImage(file)"];
+ [webView waitForMessage:@"loaded" afterEvaluatingScript:@"insertFileAsImage(file)"];
EXPECT_WK_STREQ("blob:", [webView stringByEvaluatingJavaScript:@"url = "" URL(imageElement.src); url.protocol"]);
EXPECT_WK_STREQ("100", [webView stringByEvaluatingJavaScript:@"imageElement.width"]);
}
@@ -270,7 +266,7 @@
EXPECT_WK_STREQ("image.png", [webView stringByEvaluatingJavaScript:@"pngItem.file.name"]);
EXPECT_WK_STREQ("true", [webView stringByEvaluatingJavaScript:@"dataTransfer.files.includes(pngItem.file).toString()"]);
- [webView stringByEvaluatingJavaScript:@"insertFileAsImage(pngItem.file)"];
+ [webView waitForMessage:@"loaded" afterEvaluatingScript:@"insertFileAsImage(pngItem.file)"];
EXPECT_WK_STREQ("blob:", [webView stringByEvaluatingJavaScript:@"url = "" URL(imageElement.src); url.protocol"]);
EXPECT_WK_STREQ("100", [webView stringByEvaluatingJavaScript:@"imageElement.width"]);
}