Index: third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js |
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..015d7a377e7831d4bdfaa59d1854b73d553182db |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js |
@@ -0,0 +1,27 @@ |
+(async function(testRunner) { |
+ let {page, session, dp} = await testRunner.startHTML(` |
+ <div id='node' style='background-color: red; width: 100px'></div> |
+ `, ''); |
+ |
+ dp.Animation.onAnimationCreated(() => testRunner.log('Animation created')); |
+ dp.Animation.onAnimationStarted(() => testRunner.log('Animation started')); |
+ dp.Animation.onAnimationCanceled(() => { |
+ testRunner.log('Animation canceled') |
+ testRunner.completeTest(); |
+ }); |
+ dp.Animation.enable(); |
+ |
+ session.evaluate(` |
+ node.style.transition = '1s'; |
+ node.offsetTop; |
+ node.style.width = '200px'; |
+ node.offsetTop; |
+ // Deliberately delay for two RAFs, which causes the animation to start |
+ // before we cancel it by clearing the transition. |
+ window.requestAnimationFrame(function() { |
+ window.requestAnimationFrame(function() { |
+ node.style.transition = ''; |
+ }); |
+ }); |
+ `); |
+}) |