| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** @fileoverview Tests for settings.animation. */ | 5 /** @fileoverview Tests for settings.animation. */ |
| 6 | 6 |
| 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ | 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ |
| 8 var ROOT_PATH = '../../../../../'; | 8 var ROOT_PATH = '../../../../../'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 var animation = new Animation(div, keyframes, options); | 123 var animation = new Animation(div, keyframes, options); |
| 124 animation.addEventListener('cancel', onCancelUnexpectedly); | 124 animation.addEventListener('cancel', onCancelUnexpectedly); |
| 125 animation.addEventListener('finish', onFinishBeforePromise); | 125 animation.addEventListener('finish', onFinishBeforePromise); |
| 126 | 126 |
| 127 // TODO(michaelpg): rAF seems more appropriate, but crbug.com/620160. | 127 // TODO(michaelpg): rAF seems more appropriate, but crbug.com/620160. |
| 128 setTimeout(function() { | 128 setTimeout(function() { |
| 129 expectEquals(100, div.clientHeight); | 129 expectEquals(100, div.clientHeight); |
| 130 | 130 |
| 131 animation.cancel(); | 131 animation.cancel(); |
| 132 | 132 |
| 133 // The promise should resolve before the finish event is scheduled. | 133 // The promise should be rejected before the cancel event is scheduled. |
| 134 animation.finished.catch(function() { | 134 animation.finished.catch(function() { |
| 135 expectEquals(0, div.clientHeight); | 135 expectEquals(0, div.clientHeight); |
| 136 animation.removeEventListener('cancel', onCancelUnexpectedly); | 136 animation.removeEventListener('cancel', onCancelUnexpectedly); |
| 137 animation.addEventListener('cancel', function() { | 137 animation.addEventListener('cancel', function() { |
| 138 done(); | 138 done(); |
| 139 }); | 139 }); |
| 140 }); | 140 }); |
| 141 }); | 141 }); |
| 142 }); | 142 }); |
| 143 }); | 143 }); |
| 144 | 144 |
| 145 // Run all registered tests. | 145 // Run all registered tests. |
| 146 mocha.run(); | 146 mocha.run(); |
| 147 }); | 147 }); |
| OLD | NEW |