Modified: branches/safari-605-branch/Tools/ChangeLog (228379 => 228380)
--- branches/safari-605-branch/Tools/ChangeLog 2018-02-12 17:59:12 UTC (rev 228379)
+++ branches/safari-605-branch/Tools/ChangeLog 2018-02-12 18:32:28 UTC (rev 228380)
@@ -1,3 +1,24 @@
+2018-02-12 Jason Marcell <jmarc...@apple.com>
+
+ Cherry-pick r227910. rdar://problem/37460507
+
+ 2018-01-31 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS WK2] API test DataInteractionTests.ExternalSourceDataTransferItemGetFolderAsEntry is failing after an SDK update
+ https://bugs.webkit.org/show_bug.cgi?id=182339
+ <rdar://problem/36041396>
+
+ Reviewed by Andy Estes.
+
+ This API test wasn't meant to be dependent on the size of an image generated using UIImagePNGRepresentation().
+ To make this test robust against changes to image encoding, write the raw data to the test folder instead and
+ check against the length of the data written.
+
+ * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+ (testIconImageData):
+ (runTestWithTemporaryFolder):
+ (TestWebKitAPI::TEST):
+
2018-02-09 Jason Marcell <jmarc...@apple.com>
Cherry-pick r228340. rdar://problem/37408869
Modified: branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (228379 => 228380)
--- branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2018-02-12 17:59:12 UTC (rev 228379)
+++ branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2018-02-12 18:32:28 UTC (rev 228380)
@@ -184,6 +184,11 @@
NSLog(@"Expected JSON: %@ to match values: %@", jsonString, expected);
}
+static NSData *testIconImageData()
+{
+ return [NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"icon" withExtension:@"png" subdirectory:@"TestWebKitAPI.resources"]];
+}
+
static void runTestWithTemporaryTextFile(void(^runTest)(NSURL *fileURL))
{
NSString *fileName = [NSString stringWithFormat:@"drag-drop-text-file-%@.txt", [NSUUID UUID].UUIDString];
@@ -212,7 +217,7 @@
NSError *error = nil;
NSFileManager *defaultManager = [NSFileManager defaultManager];
[defaultManager createDirectoryAtURL:temporaryFolder.get() withIntermediateDirectories:NO attributes:nil error:&error];
- [UIImagePNGRepresentation(testIconImage()) writeToURL:[temporaryFolder.get() URLByAppendingPathComponent:@"icon.png" isDirectory:NO] atomically:YES];
+ [testIconImageData() writeToURL:[temporaryFolder.get() URLByAppendingPathComponent:@"icon.png" isDirectory:NO] atomically:YES];
[testZIPArchive() writeToURL:[temporaryFolder.get() URLByAppendingPathComponent:@"archive.zip" isDirectory:NO] atomically:YES];
NSURL *firstSubdirectory = [temporaryFolder.get() URLByAppendingPathComponent:@"subdirectory1" isDirectory:YES];
@@ -1016,8 +1021,8 @@
@"DIR: /somedirectory",
@"DIR: /somedirectory/subdirectory1",
@"DIR: /somedirectory/subdirectory2",
- @"FILE: /somedirectory/archive.zip ('application/zip', 988 bytes)",
- @"FILE: /somedirectory/icon.png ('image/png', 42130 bytes)",
+ [NSString stringWithFormat:@"FILE: /somedirectory/archive.zip ('application/zip', %tu bytes)", testZIPArchive().length],
+ [NSString stringWithFormat:@"FILE: /somedirectory/icon.png ('image/png', %tu bytes)", testIconImageData().length],
@"FILE: /somedirectory/subdirectory1/text-file-1.txt ('text/plain', 43 bytes)",
@"FILE: /somedirectory/subdirectory2/text-file-2.txt ('text/plain', 44 bytes)"
];