Diff
Modified: trunk/LayoutTests/ChangeLog (208920 => 208921)
--- trunk/LayoutTests/ChangeLog 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/LayoutTests/ChangeLog 2016-11-19 07:35:47 UTC (rev 208921)
@@ -1,3 +1,17 @@
+2016-11-18 Simon Fraser <[email protected]>
+
+ [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
+ https://bugs.webkit.org/show_bug.cgi?id=164980
+
+ Reviewed by Chris Dumez.
+
+ * fast/scrolling/ios/scroll-events-default-expected.txt: Added.
+ * fast/scrolling/ios/scroll-events-default.html: Added.
+ * fast/scrolling/ios/scroll-events-responsive-expected.txt: Added.
+ * fast/scrolling/ios/scroll-events-responsive.html: Added.
+ * fast/scrolling/ios/scroll-events-unresponsive-expected.txt: Added.
+ * fast/scrolling/ios/scroll-events-unresponsive.html: Added.
+
2016-11-18 Jiewen Tan <[email protected]>
Update SubtleCrypto::decrypt to match the latest spec
Added: trunk/LayoutTests/fast/scrolling/ios/scroll-events-default-expected.txt (0 => 208921)
--- trunk/LayoutTests/fast/scrolling/ios/scroll-events-default-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scroll-events-default-expected.txt 2016-11-19 07:35:47 UTC (rev 208921)
@@ -0,0 +1,5 @@
+PASS receivedScrollEvent is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/ios/scroll-events-default.html (0 => 208921)
--- trunk/LayoutTests/fast/scrolling/ios/scroll-events-default.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scroll-events-default.html 2016-11-19 07:35:47 UTC (rev 208921)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.didEndScrollingCallback = function() {
+ uiController.uiScriptComplete();
+ }
+ uiController.scrollToOffset(0, 500);
+ })();`
+ }
+
+ var receivedScrollEvent = false;
+ function scrolled()
+ {
+ receivedScrollEvent = true;
+ }
+
+ function runTest()
+ {
+ if (!testRunner.runUIScript)
+ return;
+
+ // Test default behavior (responsive).
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function() {
+ shouldBe('receivedScrollEvent', 'true');
+ finishJSTest();
+ });
+ }
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body _onscroll_="scrolled()">
+
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/ios/scroll-events-responsive-expected.txt (0 => 208921)
--- trunk/LayoutTests/fast/scrolling/ios/scroll-events-responsive-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scroll-events-responsive-expected.txt 2016-11-19 07:35:47 UTC (rev 208921)
@@ -0,0 +1,5 @@
+PASS receivedScrollEvent is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/ios/scroll-events-responsive.html (0 => 208921)
--- trunk/LayoutTests/fast/scrolling/ios/scroll-events-responsive.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scroll-events-responsive.html 2016-11-19 07:35:47 UTC (rev 208921)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ if (window.internals)
+ internals.eventThrottlingBehaviorOverride = 'responsive';
+
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.didEndScrollingCallback = function() {
+ uiController.uiScriptComplete();
+ }
+ uiController.scrollToOffset(0, 500);
+ })();`
+ }
+
+ var receivedScrollEvent = false;
+ function scrolled()
+ {
+ receivedScrollEvent = true;
+ }
+
+ function runTest()
+ {
+ if (!testRunner.runUIScript)
+ return;
+
+ // Test default behavior (responsive).
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function() {
+ shouldBe('receivedScrollEvent', 'true');
+ finishJSTest();
+ });
+ }
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body _onscroll_="scrolled()">
+
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/ios/scroll-events-unresponsive-expected.txt (0 => 208921)
--- trunk/LayoutTests/fast/scrolling/ios/scroll-events-unresponsive-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scroll-events-unresponsive-expected.txt 2016-11-19 07:35:47 UTC (rev 208921)
@@ -0,0 +1,5 @@
+PASS receivedScrollEvent is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/ios/scroll-events-unresponsive.html (0 => 208921)
--- trunk/LayoutTests/fast/scrolling/ios/scroll-events-unresponsive.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scroll-events-unresponsive.html 2016-11-19 07:35:47 UTC (rev 208921)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ if (window.internals)
+ internals.eventThrottlingBehaviorOverride = 'unresponsive';
+
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.didEndScrollingCallback = function() {
+ uiController.uiScriptComplete();
+ }
+ uiController.scrollToOffset(0, 500);
+ })();`
+ }
+
+ var receivedScrollEvent = false;
+ function scrolled()
+ {
+ receivedScrollEvent = true;
+ }
+
+ function runTest()
+ {
+ if (!testRunner.runUIScript)
+ return;
+
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function() {
+ shouldBe('receivedScrollEvent', 'false');
+ finishJSTest();
+ });
+ }
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body _onscroll_="scrolled()">
+
+ <script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (208920 => 208921)
--- trunk/Source/WebCore/ChangeLog 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebCore/ChangeLog 2016-11-19 07:35:47 UTC (rev 208921)
@@ -1,3 +1,32 @@
+2016-11-18 Simon Fraser <[email protected]>
+
+ [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
+ https://bugs.webkit.org/show_bug.cgi?id=164980
+
+ Reviewed by Chris Dumez.
+
+ WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process
+ to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser"
+ flag that impacts tile coverage.
+
+ During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing
+ WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare().
+
+ Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior.
+
+ Tests: fast/scrolling/ios/scroll-events-default.html
+ fast/scrolling/ios/scroll-events-responsive.html
+ fast/scrolling/ios/scroll-events-unresponsive.html
+
+ * page/Page.h:
+ (WebCore::Page::eventThrottlingBehaviorOverride):
+ (WebCore::Page::setEventThrottlingBehaviorOverride):
+ * testing/Internals.cpp:
+ (WebCore::Internals::setEventThrottlingBehaviorOverride):
+ (WebCore::Internals::eventThrottlingBehaviorOverride):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2016-11-18 Chris Dumez <[email protected]>
Unreviewed attempt to fix the build after r208917.
Modified: trunk/Source/WebCore/page/Page.h (208920 => 208921)
--- trunk/Source/WebCore/page/Page.h 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebCore/page/Page.h 2016-11-19 07:35:47 UTC (rev 208921)
@@ -130,8 +130,16 @@
typedef uint64_t LinkHash;
-enum FindDirection { FindDirectionForward, FindDirectionBackward };
+enum FindDirection {
+ FindDirectionForward,
+ FindDirectionBackward
+};
+enum class EventThrottlingBehavior {
+ Responsive,
+ Unresponsive
+};
+
class Page : public Supplementable<Page> {
WTF_MAKE_NONCOPYABLE(Page);
WTF_MAKE_FAST_ALLOCATED;
@@ -533,6 +541,9 @@
bool isResourceCachingDisabled() const { return m_resourceCachingDisabled; }
void setResourceCachingDisabled(bool disabled) { m_resourceCachingDisabled = disabled; }
+ Optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const { return m_eventThrottlingBehaviorOverride; }
+ void setEventThrottlingBehaviorOverride(Optional<EventThrottlingBehavior> throttling) { m_eventThrottlingBehaviorOverride = throttling; }
+
private:
WEBCORE_EXPORT void initGroup();
@@ -724,6 +735,9 @@
bool m_controlledByAutomation { false };
bool m_resourceCachingDisabled { false };
UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { UserInterfaceLayoutDirection::LTR };
+
+ // For testing.
+ Optional<EventThrottlingBehavior> m_eventThrottlingBehaviorOverride;
};
inline PageGroup& Page::group()
Modified: trunk/Source/WebCore/testing/Internals.cpp (208920 => 208921)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-11-19 07:35:47 UTC (rev 208921)
@@ -854,6 +854,47 @@
return contextDocument()->isTimerThrottlingEnabled();
}
+void Internals::setEventThrottlingBehaviorOverride(Optional<EventThrottlingBehavior> value)
+{
+ Document* document = contextDocument();
+ if (!document || !document->page())
+ return;
+
+ if (!value) {
+ document->page()->setEventThrottlingBehaviorOverride(Nullopt);
+ return;
+ }
+
+ switch (value.value()) {
+ case Internals::EventThrottlingBehavior::Responsive:
+ document->page()->setEventThrottlingBehaviorOverride(WebCore::EventThrottlingBehavior::Responsive);
+ break;
+ case Internals::EventThrottlingBehavior::Unresponsive:
+ document->page()->setEventThrottlingBehaviorOverride(WebCore::EventThrottlingBehavior::Unresponsive);
+ break;
+ }
+}
+
+Optional<Internals::EventThrottlingBehavior> Internals::eventThrottlingBehaviorOverride() const
+{
+ Document* document = contextDocument();
+ if (!document || !document->page())
+ return Nullopt;
+
+ auto behavior = document->page()->eventThrottlingBehaviorOverride();
+ if (!behavior)
+ return Nullopt;
+
+ switch (behavior.value()) {
+ case WebCore::EventThrottlingBehavior::Responsive:
+ return Internals::EventThrottlingBehavior::Responsive;
+ case WebCore::EventThrottlingBehavior::Unresponsive:
+ return Internals::EventThrottlingBehavior::Unresponsive;
+ }
+
+ return Nullopt;
+}
+
String Internals::visiblePlaceholder(Element& element)
{
if (is<HTMLTextFormControlElement>(element)) {
Modified: trunk/Source/WebCore/testing/Internals.h (208920 => 208921)
--- trunk/Source/WebCore/testing/Internals.h 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebCore/testing/Internals.h 2016-11-19 07:35:47 UTC (rev 208921)
@@ -121,6 +121,10 @@
bool isRequestAnimationFrameThrottled() const;
bool areTimersThrottled() const;
+ enum EventThrottlingBehavior { Responsive, Unresponsive };
+ void setEventThrottlingBehaviorOverride(Optional<EventThrottlingBehavior>);
+ Optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const;
+
// Spatial Navigation testing.
ExceptionOr<unsigned> lastSpatialNavigationCandidateCount() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (208920 => 208921)
--- trunk/Source/WebCore/testing/Internals.idl 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-11-19 07:35:47 UTC (rev 208921)
@@ -70,6 +70,11 @@
"RTL"
};
+enum EventThrottlingBehavior {
+ "responsive",
+ "unresponsive"
+};
+
[
ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
NoInterfaceObject,
@@ -327,6 +332,9 @@
boolean isRequestAnimationFrameThrottled();
boolean areTimersThrottled();
+ // Override the behavior of WebPage::eventThrottlingDelay(), which only affects iOS.
+ attribute EventThrottlingBehavior? eventThrottlingBehaviorOverride;
+
[MayThrowException] void startTrackingStyleRecalcs();
[MayThrowException] unsigned long styleRecalcCount();
readonly attribute unsigned long lastStyleUpdateSize;
Modified: trunk/Source/WebKit2/ChangeLog (208920 => 208921)
--- trunk/Source/WebKit2/ChangeLog 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebKit2/ChangeLog 2016-11-19 07:35:47 UTC (rev 208921)
@@ -1,5 +1,27 @@
2016-11-18 Simon Fraser <[email protected]>
+ [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
+ https://bugs.webkit.org/show_bug.cgi?id=164980
+
+ Reviewed by Chris Dumez.
+
+ WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process
+ to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser"
+ flag that impacts tile coverage.
+
+ During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing
+ WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare().
+
+ Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageSetEventThrottlingBehaviorOverride):
+ * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::eventThrottlingDelay):
+
+2016-11-18 Simon Fraser <[email protected]>
+
Remove use of std::chrono in WebPage and entrained code
https://bugs.webkit.org/show_bug.cgi?id=164967
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (208920 => 208921)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2016-11-19 07:35:47 UTC (rev 208921)
@@ -691,3 +691,20 @@
return toAPI(&API::Array::create(WTFMove(originIdentifiers)).leakRef());
}
+
+void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef page, EventThrottlingBehavior* behavior)
+{
+ Optional<WebCore::EventThrottlingBehavior> behaviorValue;
+ if (behavior) {
+ switch (*behavior) {
+ case EventThrottlingBehaviorResponsive:
+ behaviorValue = WebCore::EventThrottlingBehavior::Responsive;
+ break;
+ case EventThrottlingBehaviorUnresponsive:
+ behaviorValue = WebCore::EventThrottlingBehavior::Unresponsive;
+ break;
+ }
+ }
+
+ toImpl(page)->corePage()->setEventThrottlingBehaviorOverride(behaviorValue);
+}
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (208920 => 208921)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h 2016-11-19 07:35:47 UTC (rev 208921)
@@ -111,6 +111,13 @@
WK_EXPORT void WKBundlePageResetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin);
WK_EXPORT WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page);
+enum EventThrottlingBehavior {
+ EventThrottlingBehaviorResponsive,
+ EventThrottlingBehaviorUnresponsive
+};
+
+WK_EXPORT void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef, EventThrottlingBehavior*);
+
#if TARGET_OS_IPHONE
WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool);
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (208920 => 208921)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2016-11-19 07:35:47 UTC (rev 208921)
@@ -2124,6 +2124,16 @@
Seconds WebPage::eventThrottlingDelay() const
{
+ auto behaviorOverride = m_page->eventThrottlingBehaviorOverride();
+ if (behaviorOverride) {
+ switch (behaviorOverride.value()) {
+ case EventThrottlingBehavior::Responsive:
+ return Seconds(0);
+ case EventThrottlingBehavior::Unresponsive:
+ return Seconds(1);
+ }
+ }
+
if (m_isInStableState || m_estimatedLatency <= Seconds(1.0 / 60))
return Seconds(0);
Modified: trunk/Tools/ChangeLog (208920 => 208921)
--- trunk/Tools/ChangeLog 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Tools/ChangeLog 2016-11-19 07:35:47 UTC (rev 208921)
@@ -1,3 +1,13 @@
+2016-11-18 Simon Fraser <[email protected]>
+
+ [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
+ https://bugs.webkit.org/show_bug.cgi?id=164980
+
+ Reviewed by Chris Dumez.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::prepare):
+
2016-11-18 Dean Jackson <[email protected]>
AX: "(inverted-colors)" media query only matches on page reload; should match on change
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (208920 => 208921)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2016-11-19 05:09:02 UTC (rev 208920)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2016-11-19 07:35:47 UTC (rev 208921)
@@ -414,6 +414,10 @@
WKBundleFrameClearOpener(WKBundlePageGetMainFrame(m_page));
WKBundlePageSetTracksRepaints(m_page, false);
+
+ // Force consistent "responsive" behavior for WebPage::eventThrottlingDelay() for testing. Tests can override via internals.
+ EventThrottlingBehavior behavior = EventThrottlingBehaviorResponsive;
+ WKBundlePageSetEventThrottlingBehaviorOverride(m_page, &behavior);
}
void InjectedBundlePage::resetAfterTest()