Chromium Code Reviews| Index: chrome/test/data/webui/test_api.js |
| diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js |
| index be8664310a231be58f9744c91e67ac0f509155e3..458aa2dfa9150a241b3c762cab9fda6a3daac391 100644 |
| --- a/chrome/test/data/webui/test_api.js |
| +++ b/chrome/test/data/webui/test_api.js |
| @@ -44,6 +44,24 @@ var testing = {}; |
| */ |
| function Test() {}; |
| + /** |
| + * Make all transitions and animations take 0ms. NOTE: this will completely |
| + * disable webkitTransitionEnd events. If your code relies on them firing, it |
| + * will break. webkitAnimationEnd events should still work. |
| + */ |
| + Test.disableAnimationsAndTransitions = function() { |
| + var noAnimationStyle = document.createElement('style'); |
| + noAnimationStyle.id = 'no-animation'; |
| + noAnimationStyle.textContent = |
| + '* {' + |
| + ' -webkit-transition-duration: 0ms !important;' + |
| + ' -webkit-transition-delay: 0ms !important;' + |
| + ' -webkit-animation-duration: 0ms !important;' + |
| + ' -webkit-animation-delay: 0ms !important;' + |
| + '}'; |
| + document.querySelector('head').appendChild(noAnimationStyle); |
| + }; |
| + |
| Test.prototype = { |
| /** |
| * The name of the test. |
| @@ -306,6 +324,12 @@ var testing = {}; |
| * @type {Function} |
| */ |
| tearDown: function() { |
| + if (!(typeof document === 'undefined')) { |
|
Dan Beam
2015/05/05 16:56:46
if (typeof document != 'undefined') {
hcarmona
2015/05/05 21:13:41
Done.
|
| + var noAnimationStyle = document.getElementById('no-animation'); |
| + if (noAnimationStyle) |
| + noAnimationStyle.parentNode.removeChild(noAnimationStyle); |
| + } |
| + |
| Mock4JS.verifyAllMocks(); |
| }, |