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.html b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js |
similarity index 21% |
rename from third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.html |
rename to third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js |
index 01aba78cba8dc3cb6af908f0b79d8ab34080cb15..015d7a377e7831d4bdfaa59d1854b73d553182db 100644 |
--- a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.html |
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-start-cancel.js |
@@ -1,51 +1,27 @@ |
-<html> |
-<head> |
-<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> |
-<script> |
+(async function(testRunner) { |
+ let {page, session, dp} = await testRunner.startHTML(` |
+ <div id='node' style='background-color: red; width: 100px'></div> |
+ `, ''); |
-function triggerEmptyTransition() |
-{ |
- node.style.transition = "1s"; |
+ 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.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 = ""; |
+ node.style.transition = ''; |
}); |
}); |
-} |
- |
-function test() |
-{ |
- InspectorTest.eventHandler["Animation.animationCreated"] = onCreated; |
- InspectorTest.eventHandler["Animation.animationStarted"] = onStarted; |
- InspectorTest.eventHandler["Animation.animationCanceled"] = onCanceled; |
- InspectorTest.sendCommand("Animation.enable", {}); |
- InspectorTest.evaluateInPage("triggerEmptyTransition()", function() {}); |
- |
- function onCreated() |
- { |
- InspectorTest.log("Animation created"); |
- } |
- |
- function onStarted() |
- { |
- InspectorTest.log("Animation started"); |
- } |
- |
- function onCanceled() |
- { |
- InspectorTest.log("Animation canceled"); |
- InspectorTest.completeTest(); |
- } |
-} |
- |
-</script> |
-</head> |
-<body onload="runTest()"> |
- <div id="node" style="background-color: red; width: 100px"></div> |
-</body> |
-</html> |
+ `); |
+}) |