[webkit-changes] [WebKit/WebKit] dcd18c: Add layout tests for ResourceMonitor
Basuke Suzuki
noreply at github.com
Tue Jan 28 14:09:16 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dcd18c28da6d7a531587b1646dad132a02b55284
https://github.com/WebKit/WebKit/commit/dcd18c28da6d7a531587b1646dad132a02b55284
Author: Basuke Suzuki <basuke at apple.com>
Date: 2025-01-28 (Tue, 28 Jan 2025)
Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/http/tests/iframe-monitor/eligibility-expected.txt
A LayoutTests/http/tests/iframe-monitor/eligibility.html
A LayoutTests/http/tests/iframe-monitor/iframe-unload-expected.txt
A LayoutTests/http/tests/iframe-monitor/iframe-unload.html
A LayoutTests/http/tests/iframe-monitor/resources/generate-byte.py
A LayoutTests/http/tests/iframe-monitor/resources/iframe--eligible--.html
A LayoutTests/http/tests/iframe-monitor/resources/iframe--eligible--2.html
A LayoutTests/http/tests/iframe-monitor/resources/iframe-not-eligible.html
A LayoutTests/http/tests/iframe-monitor/resources/iframe-not-eligible2.html
A LayoutTests/http/tests/iframe-monitor/resources/monitor-setup.js
M LayoutTests/platform/ios/TestExpectations
M LayoutTests/platform/mac-wk2/TestExpectations
M Source/WebCore/dom/Document.h
M Source/WebCore/loader/ResourceMonitor.cpp
M Source/WebCore/loader/ResourceMonitor.h
M Source/WebCore/loader/ResourceMonitorChecker.cpp
M Source/WebCore/loader/ResourceMonitorChecker.h
M Source/WebCore/loader/ResourceMonitorThrottler.cpp
M Source/WebCore/loader/ResourceMonitorThrottler.h
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
M Source/WebKit/UIProcess/API/C/WKContext.cpp
M Source/WebKit/UIProcess/API/C/WKContext.h
M Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
M Source/WebKit/UIProcess/WebProcessPool.cpp
M Source/WebKit/UIProcess/WebProcessPool.h
M Source/WebKit/UIProcess/WebProcessProxy.cpp
M Source/WebKit/UIProcess/WebProcessProxy.h
M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
M Source/WebKit/WebProcess/WebProcess.cpp
M Source/WebKit/WebProcess/WebProcess.h
M Source/WebKit/WebProcess/WebProcess.messages.in
M Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
M Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
M Tools/WebKitTestRunner/TestController.cpp
M Tools/WebKitTestRunner/TestController.h
Log Message:
-----------
Add layout tests for ResourceMonitor
https://bugs.webkit.org/show_bug.cgi?id=286318
rdar://141840408
Reviewed by Ben Nham.
Add minimum layout tests for ResourceMonitor. This covers following basic cases for iframes:
- Not be eligible for monitoring and uses small amount of load.
- Not be eligible for monitoring and uses big amount of load.
- Be eligible for monitoring and uses big amount of load.
- Be eligible for monitoring and uses small amount of load.
For easy and consistent testing, add functions to set various conditions for monitoring and
connect them to Internals and TestRunner. Also needs to
* LayoutTests/TestExpectations:
* LayoutTests/http/tests/iframe-monitor/eligibility-expected.txt: Added.
* LayoutTests/http/tests/iframe-monitor/eligibility.html: Added.
* LayoutTests/http/tests/iframe-monitor/iframe-unload-expected.txt: Added.
* LayoutTests/http/tests/iframe-monitor/iframe-unload.html: Added.
* LayoutTests/http/tests/iframe-monitor/resources/generate-byte.py: Added.
* LayoutTests/http/tests/iframe-monitor/resources/iframe--eligible--.html: Added.
* LayoutTests/http/tests/iframe-monitor/resources/iframe--eligible--2.html: Added.
* LayoutTests/http/tests/iframe-monitor/resources/iframe-not-eligible.html: Added.
* LayoutTests/http/tests/iframe-monitor/resources/iframe-not-eligible2.html: Added.
* LayoutTests/http/tests/iframe-monitor/resources/monitor-setup.js: Added.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/dom/Document.h:
(WebCore::Document::shouldSkipResourceMonitorThrottling const):
(WebCore::Document::setShouldSkipResourceMonitorThrottling):
* Source/WebCore/loader/ResourceMonitor.cpp:
(WebCore::ResourceMonitor::ResourceMonitor):
(WebCore::ResourceMonitor::setEligibility):
(WebCore::ResourceMonitor::checkNetworkUsageExcessIfNecessary):
(WebCore::networkUsageThresholdWithRandomNoise): Deleted.
* Source/WebCore/loader/ResourceMonitor.h:
* Source/WebCore/loader/ResourceMonitorChecker.cpp:
(WebCore::networkUsageThresholdWithRandomNoise):
(WebCore::ResourceMonitorChecker::checkEligibility):
(WebCore::ResourceMonitorChecker::setNetworkUsageThreshold):
* Source/WebCore/loader/ResourceMonitorChecker.h:
* Source/WebCore/loader/ResourceMonitorThrottler.cpp:
(WebCore::ResourceMonitorThrottler::setCountPerDuration):
* Source/WebCore/loader/ResourceMonitorThrottler.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::setResourceMonitorNetworkUsageThreshold):
(WebCore::Internals::shouldSkipResourceMonitorThrottling const):
(WebCore::Internals::setShouldSkipResourceMonitorThrottling):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/UIProcess/API/C/WKContext.cpp:
(WKContextSetResourceMonitorURLsForTesting):
* Source/WebKit/UIProcess/API/C/WKContext.h:
* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::createCompiledContentRuleList):
(WebKit::WebProcessPool::platformLoadResourceMonitorRuleList):
(WebKit::WebProcessPool::platformCompileResourceMonitorRuleList):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::loadOrUpdateResourceMonitorRuleList):
(WebKit::WebProcessPool::setResourceMonitorURLsForTesting):
(WebKit::WebProcessPool::platformLoadResourceMonitorRuleList):
(WebKit::WebProcessPool::platformCompileResourceMonitorRuleList):
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::requestResourceMonitorRuleLists):
(WebKit::WebProcessProxy::setResourceMonitorRuleListsIfRequired):
(WebKit::WebProcessProxy::setResourceMonitorRuleLists):
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::didExceedNetworkUsageThreshold):
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setResourceMonitorContentRuleListAsync):
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.messages.in:
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setResourceMonitorList):
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::canModifyResourceMonitorList const):
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveAsyncMessageFromInjectedBundle):
(WTR::TestController::setResourceMonitorList):
* Tools/WebKitTestRunner/TestController.h:
Canonical link: https://commits.webkit.org/289467@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list