Title: [156898] trunk/Tools
Revision
156898
Author
[email protected]
Date
2013-10-04 11:30:35 -0700 (Fri, 04 Oct 2013)

Log Message

[mac][wk2] ScrollPinningBehaviors, SpacebarScrolling, and ScrollByLineCommands fail after r156793
https://bugs.webkit.org/show_bug.cgi?id=122299

Reviewed by Beth Dakin.

* TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:
* TestWebKitAPI/Tests/WebKit2/mac/EditorCommands.mm:
The last fix didn't work; instead of trying to block, turn off threaded scrolling for all three tests.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (156897 => 156898)


--- trunk/Tools/ChangeLog	2013-10-04 18:26:35 UTC (rev 156897)
+++ trunk/Tools/ChangeLog	2013-10-04 18:30:35 UTC (rev 156898)
@@ -1,3 +1,14 @@
+2013-10-04  Tim Horton  <[email protected]>
+
+        [mac][wk2] ScrollPinningBehaviors, SpacebarScrolling, and ScrollByLineCommands fail after r156793
+        https://bugs.webkit.org/show_bug.cgi?id=122299
+
+        Reviewed by Beth Dakin.
+
+        * TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:
+        * TestWebKitAPI/Tests/WebKit2/mac/EditorCommands.mm:
+        The last fix didn't work; instead of trying to block, turn off threaded scrolling for all three tests.
+
 2013-10-04  Alexey Proskuryakov  <[email protected]>
 
         Watchlist is broken after <http://trac.webkit.org/r156880>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp (156897 => 156898)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp	2013-10-04 18:26:35 UTC (rev 156897)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp	2013-10-04 18:30:35 UTC (rev 156898)
@@ -28,12 +28,12 @@
 #include "PlatformUtilities.h"
 #include "PlatformWebView.h"
 #include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKPreferencesPrivate.h>
 
 namespace TestWebKitAPI {
 
 static bool didFinishLoad;
 static bool didNotHandleKeyDownEvent;
-static bool didFinishForceRepaint;
 
 static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
 {
@@ -46,28 +46,21 @@
         didNotHandleKeyDownEvent = true;
 }
 
-static void forceRepaintDoneCallback(WKErrorRef, void*)
-{
-    didFinishForceRepaint = true;
-}
-
-static void waitForScrollPositionUpdate(WKPageRef page)
-{
-    // Forcing a repaint also ensures that the main thread's notion of the scroll position
-    // is up to date, when using threaded scrolling.
-    didFinishForceRepaint = false;
-    WKPageForceRepaint(page, nullptr, forceRepaintDoneCallback);
-    Util::run(&didFinishForceRepaint);
-}
-
 TEST(WebKit2, SpacebarScrolling)
 {
     WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextWithInjectedBundle());
-    PlatformWebView webView(context.get());
 
+    // Turn off threaded scrolling; synchronously waiting for the main thread scroll position to
+    // update using WKPageForceRepaint would be better, but for some reason the test still fails occasionally.
+    WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(Util::toWK("NoThreadedScrollingPageGroup").get()));
+    WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get());
+    WKPreferencesSetThreadedScrollingEnabled(preferences, false);
+
+    PlatformWebView webView(context.get(), pageGroup.get());
+
     WKPageLoaderClient loaderClient;
     memset(&loaderClient, 0, sizeof(loaderClient));
-    
+
     loaderClient.version = 0;
     loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
     WKPageSetPageLoaderClient(webView.page(), &loaderClient);
@@ -86,7 +79,6 @@
     EXPECT_JS_FALSE(webView.page(), "textFieldContainsSpace()");
 
     webView.simulateSpacebarKeyPress();
-    waitForScrollPositionUpdate(webView.page());
 
     EXPECT_JS_FALSE(webView.page(), "isDocumentScrolled()");
     EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()");
@@ -104,7 +96,6 @@
 
     didNotHandleKeyDownEvent = false;
     webView.simulateSpacebarKeyPress();
-    waitForScrollPositionUpdate(webView.page());
 
     // This EXPECT_JS_TRUE test fails on Windows port
     // https://bugs.webkit.org/show_bug.cgi?id=84961

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/EditorCommands.mm (156897 => 156898)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/EditorCommands.mm	2013-10-04 18:26:35 UTC (rev 156897)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/EditorCommands.mm	2013-10-04 18:30:35 UTC (rev 156898)
@@ -29,36 +29,29 @@
 #include "PlatformWebView.h"
 #include <WebKit2/WKRetainPtr.h>
 #include <WebKit2/WKPage.h>
+#include <WebKit2/WKPreferencesPrivate.h>
 
 namespace TestWebKitAPI {
 
 static bool didFinishLoad;
-static bool didFinishForceRepaint;
 
 static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
 {
     didFinishLoad = true;
 }
 
-static void forceRepaintDoneCallback(WKErrorRef, void*)
-{
-    didFinishForceRepaint = true;
-}
-
-static void waitForScrollPositionUpdate(WKPageRef page)
-{
-    // Forcing a repaint also ensures that the main thread's notion of the scroll position
-    // is up to date, when using threaded scrolling.
-    didFinishForceRepaint = false;
-    WKPageForceRepaint(page, nullptr, forceRepaintDoneCallback);
-    Util::run(&didFinishForceRepaint);
-}
-
 TEST(WebKit2, ScrollByLineCommands)
 {
     WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextWithInjectedBundle());
-    PlatformWebView webView(context.get());
 
+    // Turn off threaded scrolling; synchronously waiting for the main thread scroll position to
+    // update using WKPageForceRepaint would be better, but for some reason the test still fails occasionally.
+    WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(Util::toWK("NoThreadedScrollingPageGroup").get()));
+    WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get());
+    WKPreferencesSetThreadedScrollingEnabled(preferences, false);
+
+    PlatformWebView webView(context.get(), pageGroup.get());
+
     WKPageLoaderClient loaderClient;
     memset(&loaderClient, 0, sizeof(loaderClient));
     loaderClient.version = 0;
@@ -74,15 +67,11 @@
     ASSERT_TRUE([webView.platformView() respondsToSelector:@selector(scrollLineDown:)]);
     [webView.platformView() scrollLineDown:nil];
 
-    waitForScrollPositionUpdate(webView.page());
-
     EXPECT_JS_EQ(webView.page(), "window.scrollY", "40");
 
     ASSERT_TRUE([webView.platformView() respondsToSelector:@selector(scrollLineUp:)]);
     [webView.platformView() scrollLineUp:nil];
 
-    waitForScrollPositionUpdate(webView.page());
-
     EXPECT_JS_EQ(webView.page(), "window.scrollY", "0");
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to