OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * @fileoverview Library providing basic test framework functionality. | 6 * @fileoverview Library providing basic test framework functionality. |
7 */ | 7 */ |
8 | 8 |
9 /** | 9 /** |
10 * Namespace for |Test|. | 10 * Namespace for |Test|. |
(...skipping 26 matching lines...) Expand all Loading... | |
37 | 37 |
38 /** | 38 /** |
39 * This class will be exported as testing.Test, and is provided to hold the | 39 * This class will be exported as testing.Test, and is provided to hold the |
40 * fixture's configuration and callback methods for the various phases of | 40 * fixture's configuration and callback methods for the various phases of |
41 * invoking a test. It is called "Test" rather than TestFixture to roughly | 41 * invoking a test. It is called "Test" rather than TestFixture to roughly |
42 * mimic the gtest's class names. | 42 * mimic the gtest's class names. |
43 * @constructor | 43 * @constructor |
44 */ | 44 */ |
45 function Test() {}; | 45 function Test() {}; |
46 | 46 |
47 /** | |
48 * Make all transitions and animations take 0ms. | |
49 * Any animations will still happen and webkit-animation-end should be | |
50 * listened to. | |
Dan Beam
2015/04/30 23:01:54
please note here that no transition end events wil
hcarmona
2015/04/30 23:16:59
Done.
| |
51 */ | |
52 Test.disableAnimationsAndTransitions = function() { | |
53 var noAnimationStyle = document.createElement('style'); | |
Dan Beam
2015/04/30 23:01:54
noAnimationStyle.id = 'no-animation';
hcarmona
2015/04/30 23:16:59
Done.
| |
54 noAnimationStyle.textContent = | |
55 '* {' + | |
56 ' -webkit-transition-duration: 0ms !important;' + | |
57 ' -webkit-transition-delay: 0ms !important;' + | |
58 ' -webkit-animation-duration: 0ms !important;' + | |
59 ' -webkit-animation-delay: 0ms !important;' + | |
60 '}'; | |
61 document.querySelector('head').appendChild(noAnimationStyle); | |
62 }; | |
63 | |
47 Test.prototype = { | 64 Test.prototype = { |
48 /** | 65 /** |
49 * The name of the test. | 66 * The name of the test. |
50 */ | 67 */ |
51 name: null, | 68 name: null, |
52 | 69 |
53 /** | 70 /** |
54 * When set to a string value representing a url, generate BrowsePreload | 71 * When set to a string value representing a url, generate BrowsePreload |
55 * call, which will browse to the url and call fixture.preLoad of the | 72 * call, which will browse to the url and call fixture.preLoad of the |
56 * currentTestCase. | 73 * currentTestCase. |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 'videoWithoutCaptions', '.supervised-user-creation-image-stream'); | 315 'videoWithoutCaptions', '.supervised-user-creation-image-stream'); |
299 } | 316 } |
300 }, | 317 }, |
301 | 318 |
302 /** | 319 /** |
303 * Override this method to perform tasks after running your test. If you | 320 * Override this method to perform tasks after running your test. If you |
304 * create a mock class, you must call Mock4JS.verifyAllMocks() in this | 321 * create a mock class, you must call Mock4JS.verifyAllMocks() in this |
305 * phase. | 322 * phase. |
306 * @type {Function} | 323 * @type {Function} |
307 */ | 324 */ |
308 tearDown: function() { | 325 tearDown: function() { |
Dan Beam
2015/04/30 23:01:54
var noAnimationStyle = $('no-animation');
if (noAn
hcarmona
2015/04/30 23:16:59
Done.
| |
309 Mock4JS.verifyAllMocks(); | 326 Mock4JS.verifyAllMocks(); |
310 }, | 327 }, |
311 | 328 |
312 /** | 329 /** |
313 * Called to run the body from the perspective of this fixture. | 330 * Called to run the body from the perspective of this fixture. |
314 * @type {Function} | 331 * @type {Function} |
315 */ | 332 */ |
316 runTest: function(testBody) { | 333 runTest: function(testBody) { |
317 testBody.call(this); | 334 testBody.call(this); |
318 }, | 335 }, |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1805 exports.TEST = TEST; | 1822 exports.TEST = TEST; |
1806 exports.TEST_F = TEST_F; | 1823 exports.TEST_F = TEST_F; |
1807 exports.RUNTIME_TEST_F = TEST_F; | 1824 exports.RUNTIME_TEST_F = TEST_F; |
1808 exports.GEN = GEN; | 1825 exports.GEN = GEN; |
1809 exports.GEN_INCLUDE = GEN_INCLUDE; | 1826 exports.GEN_INCLUDE = GEN_INCLUDE; |
1810 exports.WhenTestDone = WhenTestDone; | 1827 exports.WhenTestDone = WhenTestDone; |
1811 | 1828 |
1812 // Import the Mock4JS helpers. | 1829 // Import the Mock4JS helpers. |
1813 Mock4JS.addMockSupport(exports); | 1830 Mock4JS.addMockSupport(exports); |
1814 })(this); | 1831 })(this); |
OLD | NEW |