| 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 // See assert.js for where this is used. | 9 // See assert.js for where this is used. |
| 10 this.traceAssertionsForTesting = true; | 10 this.traceAssertionsForTesting = true; |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 | 935 |
| 936 /** | 936 /** |
| 937 * @param {string=} opt_message Additional error message. | 937 * @param {string=} opt_message Additional error message. |
| 938 * @throws {Error} | 938 * @throws {Error} |
| 939 */ | 939 */ |
| 940 function assertNotReached(opt_message) { | 940 function assertNotReached(opt_message) { |
| 941 chai.assert.fail(null, null, opt_message); | 941 chai.assert.fail(null, null, opt_message); |
| 942 } | 942 } |
| 943 | 943 |
| 944 /** | 944 /** |
| 945 * @param {Function} testFunction |
| 946 * @param {Function=|string=|RegExp=} opt_expected The expected Error |
| 947 * constructor, partial or complete error message string, or RegExp to |
| 948 * test the error message. |
| 949 * @param {string=} opt_message Additional error message. |
| 950 * @throws {Error} |
| 951 */ |
| 952 function assertThrows(testFunction, opt_expected, opt_message) { |
| 953 chai.assert.throws(testFunction, opt_expected, opt_message); |
| 954 } |
| 955 |
| 956 /** |
| 945 * Run an accessibility audit on the current page state. | 957 * Run an accessibility audit on the current page state. |
| 946 * @type {Function} | 958 * @type {Function} |
| 947 * @param {Array} a11yResults | 959 * @param {Array} a11yResults |
| 948 * @param {axs.AuditConfigutarion=} opt_config | 960 * @param {axs.AuditConfigutarion=} opt_config |
| 949 * @return {boolean} Whether there were any errors or warnings | 961 * @return {boolean} Whether there were any errors or warnings |
| 950 * @private | 962 * @private |
| 951 */ | 963 */ |
| 952 function runAccessibilityAudit(a11yResults, opt_config) { | 964 function runAccessibilityAudit(a11yResults, opt_config) { |
| 953 var auditResults = axs.Audit.run(opt_config); | 965 var auditResults = axs.Audit.run(opt_config); |
| 954 for (var i = 0; i < auditResults.length; i++) { | 966 for (var i = 0; i < auditResults.length; i++) { |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 exports.assertTrue = assertTrue; | 1690 exports.assertTrue = assertTrue; |
| 1679 exports.assertFalse = assertFalse; | 1691 exports.assertFalse = assertFalse; |
| 1680 exports.assertGE = assertGE; | 1692 exports.assertGE = assertGE; |
| 1681 exports.assertGT = assertGT; | 1693 exports.assertGT = assertGT; |
| 1682 exports.assertEquals = assertEquals; | 1694 exports.assertEquals = assertEquals; |
| 1683 exports.assertDeepEquals = assertDeepEquals; | 1695 exports.assertDeepEquals = assertDeepEquals; |
| 1684 exports.assertLE = assertLE; | 1696 exports.assertLE = assertLE; |
| 1685 exports.assertLT = assertLT; | 1697 exports.assertLT = assertLT; |
| 1686 exports.assertNotEquals = assertNotEquals; | 1698 exports.assertNotEquals = assertNotEquals; |
| 1687 exports.assertNotReached = assertNotReached; | 1699 exports.assertNotReached = assertNotReached; |
| 1700 exports.assertThrows = assertThrows; |
| 1688 } | 1701 } |
| 1689 | 1702 |
| 1690 /** | 1703 /** |
| 1691 * Exports expect methods. 'expect*' methods allow tests to run until the end | 1704 * Exports expect methods. 'expect*' methods allow tests to run until the end |
| 1692 * even in the presence of failures. | 1705 * even in the presence of failures. |
| 1693 */ | 1706 */ |
| 1694 function exportExpects() { | 1707 function exportExpects() { |
| 1695 exports.expectTrue = createExpect(assertTrue); | 1708 exports.expectTrue = createExpect(assertTrue); |
| 1696 exports.expectFalse = createExpect(assertFalse); | 1709 exports.expectFalse = createExpect(assertFalse); |
| 1697 exports.expectGE = createExpect(assertGE); | 1710 exports.expectGE = createExpect(assertGE); |
| 1698 exports.expectGT = createExpect(assertGT); | 1711 exports.expectGT = createExpect(assertGT); |
| 1699 exports.expectEquals = createExpect(assertEquals); | 1712 exports.expectEquals = createExpect(assertEquals); |
| 1700 exports.expectDeepEquals = createExpect(assertDeepEquals); | 1713 exports.expectDeepEquals = createExpect(assertDeepEquals); |
| 1701 exports.expectLE = createExpect(assertLE); | 1714 exports.expectLE = createExpect(assertLE); |
| 1702 exports.expectLT = createExpect(assertLT); | 1715 exports.expectLT = createExpect(assertLT); |
| 1703 exports.expectNotEquals = createExpect(assertNotEquals); | 1716 exports.expectNotEquals = createExpect(assertNotEquals); |
| 1704 exports.expectNotReached = createExpect(assertNotReached); | 1717 exports.expectNotReached = createExpect(assertNotReached); |
| 1705 exports.expectAccessibilityOk = createExpect(assertAccessibilityOk); | 1718 exports.expectAccessibilityOk = createExpect(assertAccessibilityOk); |
| 1719 exports.expectThrows = createExpect(assertThrows); |
| 1706 } | 1720 } |
| 1707 | 1721 |
| 1708 /** | 1722 /** |
| 1709 * Exports methods related to Mock4JS mocking. | 1723 * Exports methods related to Mock4JS mocking. |
| 1710 */ | 1724 */ |
| 1711 function exportMock4JsHelpers() { | 1725 function exportMock4JsHelpers() { |
| 1712 exports.callFunction = callFunction; | 1726 exports.callFunction = callFunction; |
| 1713 exports.callFunctionWithSavedArgs = callFunctionWithSavedArgs; | 1727 exports.callFunctionWithSavedArgs = callFunctionWithSavedArgs; |
| 1714 exports.callGlobalWithSavedArgs = callGlobalWithSavedArgs; | 1728 exports.callGlobalWithSavedArgs = callGlobalWithSavedArgs; |
| 1715 exports.eqJSON = eqJSON; | 1729 exports.eqJSON = eqJSON; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1739 exports.runTest = runTest; | 1753 exports.runTest = runTest; |
| 1740 exports.runTestFunction = runTestFunction; | 1754 exports.runTestFunction = runTestFunction; |
| 1741 exports.DUMMY_URL = DUMMY_URL; | 1755 exports.DUMMY_URL = DUMMY_URL; |
| 1742 exports.TEST = TEST; | 1756 exports.TEST = TEST; |
| 1743 exports.TEST_F = TEST_F; | 1757 exports.TEST_F = TEST_F; |
| 1744 exports.RUNTIME_TEST_F = TEST_F; | 1758 exports.RUNTIME_TEST_F = TEST_F; |
| 1745 exports.GEN = GEN; | 1759 exports.GEN = GEN; |
| 1746 exports.GEN_INCLUDE = GEN_INCLUDE; | 1760 exports.GEN_INCLUDE = GEN_INCLUDE; |
| 1747 exports.WhenTestDone = WhenTestDone; | 1761 exports.WhenTestDone = WhenTestDone; |
| 1748 })(this); | 1762 })(this); |
| OLD | NEW |