Title: [218276] trunk/Tools
Revision
218276
Author
[email protected]
Date
2017-06-14 11:22:39 -0700 (Wed, 14 Jun 2017)

Log Message

WKContentViewEditingActions API test always fails
https://bugs.webkit.org/show_bug.cgi?id=173374

Reviewed by Wenson Hsieh.

* TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm:
(TEST):
selectAll isn't working, because canPerformAction for selectAll returns NO
if selectionIsNone (which is true in the non-contenteditable case).
Instead, make use of r218180's test page, which knows how to select itself.
Also, reset the pasteboard at the beginning of the test to reduce confusion
(I landed the test broken because my simulator had the correct text
stuck in its pasteboard).

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (218275 => 218276)


--- trunk/Tools/ChangeLog	2017-06-14 18:15:50 UTC (rev 218275)
+++ trunk/Tools/ChangeLog	2017-06-14 18:22:39 UTC (rev 218276)
@@ -1,3 +1,19 @@
+2017-06-14  Tim Horton  <[email protected]>
+
+        WKContentViewEditingActions API test always fails
+        https://bugs.webkit.org/show_bug.cgi?id=173374
+
+        Reviewed by Wenson Hsieh.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm:
+        (TEST):
+        selectAll isn't working, because canPerformAction for selectAll returns NO
+        if selectionIsNone (which is true in the non-contenteditable case).
+        Instead, make use of r218180's test page, which knows how to select itself.
+        Also, reset the pasteboard at the beginning of the test to reduce confusion
+        (I landed the test broken because my simulator had the correct text
+        stuck in its pasteboard).
+
 2017-06-14  Jonathan Bedard  <[email protected]>
 
         Configure screen scale for running layout tests on plus devices

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm (218275 => 218276)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm	2017-06-14 18:15:50 UTC (rev 218275)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm	2017-06-14 18:22:39 UTC (rev 218276)
@@ -50,25 +50,30 @@
 
 TEST(WebKit2, WKContentViewEditingActions)
 {
+    [UIPasteboard generalPasteboard].items = @[];
+
     RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
 
-    [webView synchronouslyLoadTestPageNamed:@"simple"];
+    [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"];
 
+    [webView stringByEvaluatingJavaScript:@"selectPlainText()"];
+
     UIView *contentView = recursiveFindWKContentView(webView.get());
 
-    if ([contentView canPerformAction:@selector(selectAll:) withSender:nil])
-        [contentView selectAll:nil];
+    __block bool done = false;
+
     [webView _doAfterNextPresentationUpdate:^ {
         if ([contentView canPerformAction:@selector(copy:) withSender:nil])
             [contentView copy:nil];
+
+        [webView _doAfterNextPresentationUpdate:^ {
+            done = true;
+        }];
     }];
 
-    while (1) {
-        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
-        if ([[[UIPasteboard generalPasteboard] string] isEqualToString:@"Simple HTML file."])
-            break;
-        TestWebKitAPI::Util::sleep(0.01);
-    }
+    TestWebKitAPI::Util::run(&done);
+
+    EXPECT_WK_STREQ("Hello world", [[UIPasteboard generalPasteboard] string]);
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to