Commit 5b626200 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[throughput] Add new story for on-screen no damage animations

This CL adds a few perf tests for the on-screen no damage cases.
To be more specific, we create animations that causes no damage, for
example animation from translateX(0) to translateX(0).

At this moment, the on-screen no damage cases should not report
any histogram, because the frames_expected would be 0.

Bug: 1048163
Change-Id: Id315e98b32d5a9e55b85a96d1ed2d5d59003a983
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035858Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738418}
parent ee5af39b
<!doctype html>
<!--
Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
#mainanim {
width: 200px;
height: 200px;
background-color: red;
will-change: transform;
}
#cssanim {
width: 200px;
height: 200px;
background-color: green;
}
@keyframes mymove {
0% { transform: translateX(0px); }
100% { transform: translateX(0px); }
}
.anim {
animation: mymove 1s linear infinite;
}
.paused {
animation-play-state: paused;
}
</style>
</head>
<body>
<div id='mainanim'></div>
<hr>
<div id='cssanim' class='anim paused'></div>
<hr>
Press any key to toggle animation.
</body>
<script>
const targetMainFps =
window.location.hash.length > 1 ? +window.location.hash.substr(1) : 0;
const skipEvery = targetMainFps > 0 ? parseInt(60 / targetMainFps) : 0;
const shouldJank = window.location.search.indexOf('?jank') >= 0;
const attributeName = 'transform';
var animating = false;
var frameCount = 0;
function animateStep() {
if (skipEvery && ++frameCount % skipEvery == 0) {
if (shouldJank) {
const now = new Date();
while ((new Date() - now) < 16) {}
}
mainanim.style[attributeName] = 'translateX(0px)';
}
if (animating)
requestAnimationFrame(animateStep);
}
function startAnimation() {
animating = true;
requestAnimationFrame(animateStep);
cssanim.classList.remove('paused');
}
function stopAnimation() {
animating = false;
cssanim.classList.add('paused');
}
function toggle() {
if (animating) {
stopAnimation();
} else {
startAnimation();
}
}
window.onkeypress = toggle;
</script>
</html>
......@@ -23,6 +23,20 @@ class MainZeroImplSixty(ThroughputMetricStory):
'main-impl-animations-throughput.html')
class MainZeroImplSixtyNoUpdate(ThroughputMetricStory):
BASE_NAME = 'main_0fps_impl_60fps_no_update'
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
'main-impl-animations-no-update-throughput.html')
class MainZeroImplSixtyNoUpdateJank(ThroughputMetricStory):
BASE_NAME = 'main_0fps_impl_60fps_no_update_jank'
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
'main-impl-animations-no-update-throughput.html?jank')
class MainThirtyImplSixty(ThroughputMetricStory):
BASE_NAME = 'main_30fps_impl_60fps'
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
......@@ -42,6 +56,20 @@ class MainSixtyImplSixty(ThroughputMetricStory):
'main-impl-animations-throughput.html#60')
class MainSixtyImplSixtyNoUpdate(ThroughputMetricStory):
BASE_NAME = 'main_60fps_impl_60fps_no_update'
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
'main-impl-animations-no-update-throughput.html#60')
class MainSixtyImplSixtyNoUpdateJank(ThroughputMetricStory):
BASE_NAME = 'main_60fps_impl_60fps_no_update_jank'
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
'main-impl-animations-no-update-throughput.html?jank#60')
class MainFifteenImplZero(ThroughputMetricStory):
BASE_NAME = 'main_15fps_impl_0fps'
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
......
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