Commit 8b20c595 authored by Xiyuan Xia's avatar Xiyuan Xia Committed by Commit Bot

autotest: Make stopSmoothnessTracking to return frame data

Make stopSmoothnessTracking to return ThroughputTrackerAnimationData
that contains raw metrics data so that tast side could calculate
jank metrics as well as smoothness.

Bug: 1132017
Change-Id: If1a64d1b681505d0baece3bd7650c1e8a04351b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2488664
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820363}
parent 0b0729fc
......@@ -4718,8 +4718,14 @@ AutotestPrivateStopSmoothnessTrackingFunction::Run() {
void AutotestPrivateStopSmoothnessTrackingFunction::OnReportData(
const cc::FrameSequenceMetrics::CustomReportData& data) {
Respond(
OneArgument(base::Value(ash::metrics_util::CalculateSmoothness(data))));
api::autotest_private::ThroughputTrackerAnimationData result_data;
result_data.frames_expected = data.frames_expected;
result_data.frames_produced = data.frames_produced;
result_data.jank_count = data.jank_count;
Respond(ArgumentList(
api::autotest_private::StopSmoothnessTracking::Results::Create(
result_data)));
}
///////////////////////////////////////////////////////////////////////////////
......
......@@ -558,10 +558,6 @@ namespace autotestPrivate {
};
callback WindowBoundsCallback = void (SetWindowBoundsResult result);
// Callback invoked to report the smoothness after StopSmoothnessTracking is
// called. |smoothness| is a percentage number between 0 to 100.
callback StopSmoothnessTrackingCallback = void (long smoothness);
// Collected ui::ThroughputTracker data for one animation. It is based on
// cc::FrameSequenceMetrics::ThroughputData.
dictionary ThroughputTrackerAnimationData {
......@@ -574,6 +570,11 @@ namespace autotestPrivate {
long jankCount;
};
// Callback invoked to report the smoothness after StopSmoothnessTracking is
// called.
callback StopSmoothnessTrackingCallback = void
(ThroughputTrackerAnimationData data);
// Callback invoked to report the collection ui::ThroughputTracker data
// after stopThroughputTrackerDataCollection is called.
callback StopThroughputTrackerDataCollectionCallback = void
......
......@@ -890,9 +890,11 @@ var defaultTests = [
// Wait for a few frames.
await raf();
chrome.autotestPrivate.stopSmoothnessTracking(function(smoothness) {
chrome.autotestPrivate.stopSmoothnessTracking(function(data) {
chrome.test.assertNoLastError();
chrome.test.assertTrue(smoothness >= 0 && smoothness <= 100);
chrome.test.assertTrue(data.hasOwnProperty('framesExpected') ||
data.hasOwnProperty('framesProduced') ||
data.hasOwnProperty('jankCount'));
chrome.test.succeed();
});
});
......@@ -912,14 +914,16 @@ var defaultTests = [
await raf();
chrome.autotestPrivate.stopSmoothnessTracking(badDisplay,
function(smoothness) {
function(data) {
chrome.test.assertEq(chrome.runtime.lastError.message,
'Smoothness is not tracked for display: -1');
chrome.autotestPrivate.stopSmoothnessTracking(displayId,
function(smoothness) {
function(data) {
chrome.test.assertNoLastError();
chrome.test.assertTrue(smoothness >= 0 && smoothness <= 100);
chrome.test.assertTrue(data.hasOwnProperty('framesExpected') ||
data.hasOwnProperty('framesProduced') ||
data.hasOwnProperty('jankCount'));
chrome.test.succeed();
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment