Fix for intermittent Layout Test fail http/tests/loading/resourceLoadStatistics/telem...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jun 2017 22:22:35 +0000 (22:22 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jun 2017 22:22:35 +0000 (22:22 +0000)
commit003623460d11dc806be7f1cc3985552e9f60320d
tree4af2dec4d10f8fdc144b32fa5e07ea407e8dc6aa
parent24dc988fc3707f782970b16c4fe5d74afba9623e
Fix for intermittent Layout Test fail http/tests/loading/resourceLoadStatistics/telemetry-generation.html
https://bugs.webkit.org/show_bug.cgi?id=173940
<rdar://problem/33018125>

Reviewed by Brent Fulgham.

Source/WebCore:

No new tests. This change enables the exiting test to pass.

* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
    Added an assert.

Source/WebKit2:

This change allows the TestController to turn off
regular resource load statistics telemetry submission
and to manually control when telemetry is calculated
and submitted.

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
    New test infrastructure.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::setShouldSubmitTelemetry):
    New test infrastructure.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
    New test infrastructure.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    The test function now calls
    WebResourceLoadStatisticsStore::submitTelemetry() directly
    instead of firing the timer.
(WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
    Now checks whether it should submit telemetry or not.
(WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
    Split out so that the test code doesn't have to fire the timer.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
(WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
    Now doesn't submit if it's executed by test code.

Tools:

This change allows the TestController to turn off
regular resource load statistics telemetry submission
and to manually control when telemetry is calculated
and submitted.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
    Turns off automatic resource load statistics telemetry submission.

LayoutTests:

* platform/wk2/TestExpectations:
    http/tests/loading/resourceLoadStatistics/telemetry-generation.html
    is now expected to pass.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadStatisticsStore.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp
Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsTelemetry.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp