OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 function WebUIA11yAuditBrowserTest() {} |
| 6 |
| 7 WebUIA11yAuditBrowserTest.prototype = { |
| 8 __proto__: testing.Test.prototype, |
| 9 |
| 10 browsePreload: 'chrome://terms', |
| 11 |
| 12 runA11yChecks: true, |
| 13 a11yIssuesAreErrors: true, |
| 14 }; |
| 15 |
| 16 function addAuditFailures() { |
| 17 var style = document.createElement('style'); |
| 18 style.innerText = 'p { color: #ffffff }'; |
| 19 document.head.appendChild(style); |
| 20 } |
| 21 |
| 22 function expectAuditWillNotRun() { |
| 23 axs.AuditRule.prototype.run = function() { |
| 24 assertTrue(false, 'AuditRule.run should not be executed'); |
| 25 }; |
| 26 } |
| 27 |
| 28 RUNTIME_TEST_F('WebUIA11yAuditBrowserTest', 'testWithAuditFailures', function()
{ |
| 29 addAuditFailures(); |
| 30 }); |
| 31 |
| 32 RUNTIME_TEST_F('WebUIA11yAuditBrowserTest', |
| 33 'testWithAuditFailures_a11yChecksDisabled', |
| 34 function() { |
| 35 expectAuditWillNotRun(); |
| 36 disableA11yChecks(); |
| 37 a11yIssuesAreErrors(false); |
| 38 addAuditFailures(); |
| 39 }); |
| 40 |
| 41 function WebUIA11yAuditBrowserTest_TestsDisabledInFixture() {} |
| 42 |
| 43 WebUIA11yAuditBrowserTest_TestsDisabledInFixture.prototype = { |
| 44 __proto__: WebUIA11yAuditBrowserTest.prototype, |
| 45 |
| 46 runA11yChecks: false, |
| 47 }; |
| 48 |
| 49 RUNTIME_TEST_F('WebUIA11yAuditBrowserTest_TestsDisabledInFixture', |
| 50 'testWithAuditFailures', |
| 51 function() { |
| 52 enableA11yChecks(); |
| 53 addAuditFailures(); |
| 54 }); |
| 55 |
| 56 RUNTIME_TEST_F('WebUIA11yAuditBrowserTest_TestsDisabledInFixture', |
| 57 'testWithAuditFailures_a11yChecksNotEnabled', |
| 58 function() { |
| 59 expectAuditWillNotRun(); |
| 60 addAuditFailures(); |
| 61 }); |
| 62 |
| 63 function WebUIA11yAuditBrowserTest_IssuesAreWarnings() {} |
| 64 |
| 65 WebUIA11yAuditBrowserTest_IssuesAreWarnings.prototype = { |
| 66 __proto__: WebUIA11yAuditBrowserTest.prototype, |
| 67 |
| 68 runA11yChecks: false, |
| 69 }; |
| 70 |
| 71 RUNTIME_TEST_F('WebUIA11yAuditBrowserTest_IssuesAreWarnings', |
| 72 'testWithAuditFailures', |
| 73 function() { |
| 74 enableA11yChecks(); |
| 75 addAuditFailures(); |
| 76 }); |
OLD | NEW |