RESOLVED FIXED 143286
Expand test infrastructure to support scrolling tests (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=143286
Summary Expand test infrastructure to support scrolling tests (Part 1)
Brent Fulgham
Reported 2015-03-31 17:25:20 PDT
Our scrolling tests currently rely on large timeouts to ensure that tests work properly. This is because we need to wait to check our final DOM state until any scroll-generated animations complete. For example, we need to wait until any rubber banding or scroll-snap animations complete before we can determine if the scroll gesture moved us to the proper location. This change adds a new test EventSender object method called "callAfterScrollingCompletes". This new method will be called when the scroll animations are finished, greatly reducing the need for arbitrary timeouts.
Attachments
Patch (134.05 KB, patch)
2015-03-31 17:59 PDT, Brent Fulgham
no flags
Patch (130.92 KB, patch)
2015-03-31 18:04 PDT, Brent Fulgham
no flags
Patch (130.92 KB, patch)
2015-03-31 18:08 PDT, Brent Fulgham
no flags
Patch (131.47 KB, patch)
2015-03-31 18:15 PDT, Brent Fulgham
no flags
Archive of layout-test-results from ews101 for mac-mavericks (644.44 KB, application/zip)
2015-03-31 18:54 PDT, Build Bot
no flags
Patch (167.56 KB, patch)
2015-04-02 20:46 PDT, Brent Fulgham
no flags
Patch (No longer based on global state) (164.84 KB, patch)
2015-04-02 21:02 PDT, Brent Fulgham
no flags
Archive of layout-test-results from ews100 for mac-mavericks (514.69 KB, application/zip)
2015-04-02 21:49 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (567.93 KB, application/zip)
2015-04-02 21:53 PDT, Build Bot
no flags
Patch (167.66 KB, patch)
2015-04-03 09:29 PDT, Brent Fulgham
no flags
Patch (167.75 KB, patch)
2015-04-03 09:31 PDT, Brent Fulgham
no flags
Patch (Revised to correct test failure) (167.77 KB, patch)
2015-04-03 09:56 PDT, Brent Fulgham
no flags
Archive of layout-test-results from ews100 for mac-mavericks (525.92 KB, application/zip)
2015-04-03 10:48 PDT, Build Bot
no flags
Patch (Revised for non-Mac build failures, and documenting a test problem found by this work). (168.55 KB, patch)
2015-04-03 11:16 PDT, Brent Fulgham
no flags
Patch (38.65 KB, patch)
2015-04-03 18:00 PDT, Brent Fulgham
no flags
Archive of layout-test-results from ews101 for mac-mavericks (536.20 KB, application/zip)
2015-04-03 18:52 PDT, Build Bot
no flags
Patch (39.35 KB, patch)
2015-04-06 08:59 PDT, Brent Fulgham
no flags
Patch (39.73 KB, patch)
2015-04-06 09:40 PDT, Brent Fulgham
no flags
Patch (Correct iOS build) (39.79 KB, patch)
2015-04-06 10:21 PDT, Brent Fulgham
no flags
Patch Part 1: (Version has Another iOS fix) (39.75 KB, patch)
2015-04-06 11:33 PDT, Brent Fulgham
no flags
Patch (39.55 KB, patch)
2015-04-10 13:23 PDT, Brent Fulgham
no flags
Wrong Bug! (38.54 KB, patch)
2015-04-23 17:23 PDT, Brent Fulgham
no flags
Wrong Bug! (39.32 KB, patch)
2015-04-24 09:00 PDT, Brent Fulgham
no flags
Wrong Bug (39.30 KB, patch)
2015-04-24 10:27 PDT, Brent Fulgham
no flags
Radar WebKit Bug Importer
Comment 1 2015-03-31 17:26:24 PDT
Brent Fulgham
Comment 2 2015-03-31 17:59:24 PDT
Brent Fulgham
Comment 3 2015-03-31 18:04:37 PDT
Brent Fulgham
Comment 4 2015-03-31 18:08:31 PDT
Brent Fulgham
Comment 5 2015-03-31 18:15:19 PDT
Brent Fulgham
Comment 6 2015-03-31 18:20:15 PDT
The first question for reviewers is whether implementing this as a Singleton is the right approach. I initially tried to have this be a member of the MainFrame. However, making the various ScrollController instances (which do not generally have visibility of their containing objects) was going to involve threading a lot of MainFrame arguments through various create functions.
Simon Fraser (smfr)
Comment 7 2015-03-31 18:31:22 PDT
Comment on attachment 249878 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=249878&action=review > Source/WebCore/page/WheelEventTestTrigger.cpp:62 > + setTestNotificationCallback([=](void) { > + JSObjectCallAsFunction(context, functionCallback, nullptr, 0, nullptr, nullptr); > + JSValueUnprotect(context, functionCallback); > + }); > +} I don't think we should have test code like this compiled into webcore all the time. It feels like this WheelEventTestTrigger thing should be some kind of delegate that's only hooked up during testing.
Build Bot
Comment 8 2015-03-31 18:54:13 PDT
Comment on attachment 249878 [details] Patch Attachment 249878 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5761338848575488 New failing tests: scrollbars/scrollevent-iframe-no-scrolling-wheel.html
Build Bot
Comment 9 2015-03-31 18:54:16 PDT
Created attachment 249880 [details] Archive of layout-test-results from ews101 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-mavericks Platform: Mac OS X 10.9.5
Brent Fulgham
Comment 10 2015-04-01 09:46:29 PDT
Note: This test failure indicates that the test doesn't work as expected -- the event handler is actually not locating a valid target NSView to process the event! That is not new with this change -- we can now just see that the test is not working properly.
Brent Fulgham
Comment 11 2015-04-02 20:46:01 PDT
Brent Fulgham
Comment 12 2015-04-02 21:02:08 PDT
Created attachment 250036 [details] Patch (No longer based on global state)
Brent Fulgham
Comment 13 2015-04-02 21:07:18 PDT
Comment on attachment 250036 [details] Patch (No longer based on global state) Revised version of the patch that tracks test state on the MainFrame, but only when the test system registers to monitor wheel events.
Build Bot
Comment 14 2015-04-02 21:49:33 PDT
Comment on attachment 250036 [details] Patch (No longer based on global state) Attachment 250036 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4823346982158336 Number of test failures exceeded the failure limit.
Build Bot
Comment 15 2015-04-02 21:49:38 PDT
Created attachment 250038 [details] Archive of layout-test-results from ews100 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 16 2015-04-02 21:53:34 PDT
Comment on attachment 250036 [details] Patch (No longer based on global state) Attachment 250036 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6009453941882880 Number of test failures exceeded the failure limit.
Build Bot
Comment 17 2015-04-02 21:53:38 PDT
Created attachment 250039 [details] Archive of layout-test-results from ews107 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Brent Fulgham
Comment 18 2015-04-02 22:08:35 PDT
Comment on attachment 250036 [details] Patch (No longer based on global state) Looks like it's hitting some assertions I added to check for missing MainFram attachment. There must be another code path for constructing scroll animators I need to handle.
Brent Fulgham
Comment 19 2015-04-03 09:29:35 PDT
Brent Fulgham
Comment 20 2015-04-03 09:31:55 PDT
Brent Fulgham
Comment 21 2015-04-03 09:56:42 PDT
Created attachment 250083 [details] Patch (Revised to correct test failure)
Brent Fulgham
Comment 22 2015-04-03 09:57:37 PDT
Comment on attachment 250083 [details] Patch (Revised to correct test failure) Corrected cause of 'fast/forms/search/search-scroll-hidden-decoration-container-crash.html' failure.
Build Bot
Comment 23 2015-04-03 10:48:21 PDT
Comment on attachment 250083 [details] Patch (Revised to correct test failure) Attachment 250083 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5320753788485632 New failing tests: scrollbars/scrollevent-iframe-no-scrolling-wheel.html
Build Bot
Comment 24 2015-04-03 10:48:26 PDT
Created attachment 250089 [details] Archive of layout-test-results from ews100 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mavericks Platform: Mac OS X 10.9.5
Brent Fulgham
Comment 25 2015-04-03 11:16:45 PDT
Created attachment 250090 [details] Patch (Revised for non-Mac build failures, and documenting a test problem found by this work).
Brent Fulgham
Comment 26 2015-04-03 11:18:27 PDT
Comment on attachment 250090 [details] Patch (Revised for non-Mac build failures, and documenting a test problem found by this work). Correct the build errors encountered on iOS/EFL/GTK. Also mark the WK1 version of "scrollbars/scrollevent-iframe-no-scrolling-wheel.html" as failing. This is not a bug caused by this patch; the test is already wrong, the patch just added logging that identified the problem.
Brent Fulgham
Comment 27 2015-04-03 18:00:00 PDT
Build Bot
Comment 28 2015-04-03 18:52:07 PDT
Comment on attachment 250112 [details] Patch Attachment 250112 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/6490975409012736 New failing tests: scrollbars/scrollevent-iframe-no-scrolling-wheel.html
Build Bot
Comment 29 2015-04-03 18:52:11 PDT
Created attachment 250114 [details] Archive of layout-test-results from ews101 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-mavericks Platform: Mac OS X 10.9.5
Brent Fulgham
Comment 30 2015-04-06 08:59:28 PDT
Brent Fulgham
Comment 31 2015-04-06 09:40:51 PDT
Brent Fulgham
Comment 32 2015-04-06 10:21:55 PDT
Created attachment 250209 [details] Patch (Correct iOS build)
Brent Fulgham
Comment 33 2015-04-06 11:33:47 PDT
Created attachment 250214 [details] Patch Part 1: (Version has Another iOS fix)
Simon Fraser (smfr)
Comment 34 2015-04-10 11:52:17 PDT
Comment on attachment 250214 [details] Patch Part 1: (Version has Another iOS fix) View in context: https://bugs.webkit.org/attachment.cgi?id=250214&action=review > Source/WebCore/page/MainFrame.cpp:53 > + , m_testTrigger(nullptr) No need to initialize a unique_ptr. > Source/WebCore/page/MainFrame.cpp:129 > +WheelEventTestTrigger* MainFrame::testTrigger() const ? > Source/WebCore/page/MainFrame.cpp:138 > +WheelEventTestTrigger* MainFrame::initializeTestTrigger() > +{ > + m_testTrigger = std::make_unique<WheelEventTestTrigger>(); > + > + return m_testTrigger.get(); This is susceptible to doing the wrong thing if called more than once. Maybe ensureTestTrigger()? > Source/WebCore/page/WheelEventTestTrigger.cpp:33 > +#include <JavaScriptCore/JSObjectRef.h> > +#include <JavaScriptCore/JSRetainPtr.h> Do you still need these? > Source/WebCore/page/WheelEventTestTrigger.cpp:63 > + std::lock_guard<std::mutex> lock(m_testTriggerMutex); > + m_testNotificationCallback = WTF::move(functionCallback); > + > + if (!m_testTriggerTimer.isActive()) > + m_testTriggerTimer.startRepeating(1.0 / 60.0); > +} Seems odd to hold the lock over starting a timer. I think you need to be more explicit about what the lock is protecting (presumably just the m_deferTestTriggerReasons and callback? Or just m_deferTestTriggerReasons? > Source/WebCore/page/WheelEventTestTrigger.cpp:92 > + std::lock_guard<std::mutex> lock(m_testTriggerMutex); Don't we use WTF::mutex etc? > Source/WebCore/page/WheelEventTestTrigger.cpp:97 > + if (m_testNotificationCallback) > + m_testNotificationCallback(); Do you really want to hold the lock over calling the callback? > Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:577 > +void WKBundlePageMonitoringWheelEvents(WKBundlePageRef pageRef) The name makes it sound like a getter "is the page monitoring wheel events?". Would be better as WKBundlePageStartMonitoringWheelEvents(), or WKBundlePageMonitoringScrollingSomething > Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:588 > +void WKBundlePageRegisterTestNotificationCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, void* context) What kind of test notification? Doesn't sound related to the previous thing; would be better as WKBundlePageRegisterScrollingSomethingCompletion
Brent Fulgham
Comment 35 2015-04-10 12:49:14 PDT
Comment on attachment 250214 [details] Patch Part 1: (Version has Another iOS fix) View in context: https://bugs.webkit.org/attachment.cgi?id=250214&action=review >> Source/WebCore/page/MainFrame.cpp:53 >> + , m_testTrigger(nullptr) > > No need to initialize a unique_ptr. OK! >> Source/WebCore/page/MainFrame.cpp:129 >> +WheelEventTestTrigger* MainFrame::testTrigger() > > const ? OK! >> Source/WebCore/page/MainFrame.cpp:138 >> + return m_testTrigger.get(); > > This is susceptible to doing the wrong thing if called more than once. Maybe ensureTestTrigger()? OK! >> Source/WebCore/page/WheelEventTestTrigger.cpp:33 >> +#include <JavaScriptCore/JSRetainPtr.h> > > Do you still need these? Good point. I'll remove them. >> Source/WebCore/page/WheelEventTestTrigger.cpp:63 >> +} > > Seems odd to hold the lock over starting a timer. I think you need to be more explicit about what the lock is protecting (presumably just the m_deferTestTriggerReasons and callback? Or just m_deferTestTriggerReasons? Yes. I think assignment of the callback should be protected as well, though maybe that's not as important. I mainly want to avoid two threads trying to insert deferral reasons at the same time. It's probably not likely (or even possible) for two threads to update the notification callback, so maybe this lock isn't really warranted. >> Source/WebCore/page/WheelEventTestTrigger.cpp:92 >> + std::lock_guard<std::mutex> lock(m_testTriggerMutex); > > Don't we use WTF::mutex etc? Anders says use STL now. >> Source/WebCore/page/WheelEventTestTrigger.cpp:97 >> + m_testNotificationCallback(); > > Do you really want to hold the lock over calling the callback? No. >> Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:577 >> +void WKBundlePageMonitoringWheelEvents(WKBundlePageRef pageRef) > > The name makes it sound like a getter "is the page monitoring wheel events?". Would be better as WKBundlePageStartMonitoringWheelEvents(), or WKBundlePageMonitoringScrollingSomething OK. I like WKBundlePageStartMonitoringScrollOperations >> Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:588 >> +void WKBundlePageRegisterTestNotificationCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, void* context) > > What kind of test notification? Doesn't sound related to the previous thing; would be better as WKBundlePageRegisterScrollingSomethingCompletion How about WKBundlePageRegisterScrollOperationCompletionCallback?
Brent Fulgham
Comment 36 2015-04-10 13:23:11 PDT
Simon Fraser (smfr)
Comment 37 2015-04-13 10:52:50 PDT
Comment on attachment 250529 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250529&action=review > Source/WebCore/page/WheelEventTestTrigger.cpp:53 > +void WheelEventTestTrigger::setTestNotificationCallback(std::function<void()> functionCallback) This name doesn't imply that it's going to start a timer, so perhaps a better name? > Source/WebCore/page/WheelEventTestTrigger.cpp:55 > + { // Limit scope of mutex I don't think the comment is necessary. > Source/WebCore/page/WheelEventTestTrigger.cpp:70 > + auto it = m_deferTestTriggerReasons.find(key); > + if (it == m_deferTestTriggerReasons.end()) { > + m_deferTestTriggerReasons.add(key, std::set<DeferTestTriggerReason>()); > + it = m_deferTestTriggerReasons.find(key); You should just call add() and look at the AddResult. > Source/WebCore/page/WheelEventTestTrigger.cpp:86 > + m_deferTestTriggerReasons.remove(key); Can't you remove with the it, to avoid another hash lookup? > Source/WebCore/page/WheelEventTestTrigger.cpp:93 > + { // Limit scope of mutex No need for comment. > Source/WebCore/page/WheelEventTestTrigger.h:54 > + void deferTestsForReason(void* key, DeferTestTriggerReason); Very unclear what the void* key should be here. Maybe a typedef with a better name? Can it be any token that just has to match the one passed to removeTestDeferralForReason?
Brent Fulgham
Comment 38 2015-04-13 17:06:16 PDT
Brent Fulgham
Comment 39 2015-04-23 17:23:09 PDT
Reopening to attach new patch.
Brent Fulgham
Comment 40 2015-04-23 17:23:11 PDT
Created attachment 251515 [details] Wrong Bug!
WebKit Commit Bot
Comment 41 2015-04-23 17:24:40 PDT
Attachment 251515 [details] did not pass style-queue: ERROR: Source/WebCore/page/scrolling/ThreadedScrollingTree.h:61: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] ERROR: Source/WebCore/page/scrolling/ScrollingTree.h:140: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] ERROR: Source/WebCore/platform/ScrollAnimator.h:121: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 3 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 42 2015-04-24 09:00:43 PDT
Created attachment 251552 [details] Wrong Bug!
Brent Fulgham
Comment 43 2015-04-24 10:27:28 PDT
Created attachment 251556 [details] Wrong Bug
Brent Fulgham
Comment 44 2015-04-24 11:13:14 PDT
This was accidentally reopened when I used the wrong bug number in my patch.
Note You need to log in before you can comment on or make changes to this bug.