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 The way these tests work is as follows: | 6 * @fileoverview The way these tests work is as follows: |
7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then | 7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then |
8 * calls the entry point for a test with RunJavascriptTest. The called | 8 * calls the entry point for a test with RunJavascriptTest. The called |
9 * function can then use the assert/expect functions defined in test_api.js. | 9 * function can then use the assert/expect functions defined in test_api.js. |
10 * All callbacks from the browser are wrapped in such a way that they can | 10 * All callbacks from the browser are wrapped in such a way that they can |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 */ | 49 */ |
50 typedefCppFixture: 'NetInternalsTest', | 50 typedefCppFixture: 'NetInternalsTest', |
51 | 51 |
52 /** @inheritDoc */ | 52 /** @inheritDoc */ |
53 browsePreload: 'chrome://net-internals/', | 53 browsePreload: 'chrome://net-internals/', |
54 | 54 |
55 /** @inheritDoc */ | 55 /** @inheritDoc */ |
56 isAsync: true, | 56 isAsync: true, |
57 | 57 |
58 setUp: function() { | 58 setUp: function() { |
| 59 testing.Test.prototype.setUp.call(this); |
| 60 |
59 // Enforce accessibility auditing, but suppress some false positives. | 61 // Enforce accessibility auditing, but suppress some false positives. |
60 this.accessibilityIssuesAreErrors = true; | 62 this.accessibilityIssuesAreErrors = true; |
61 // False positive because a unicode character is used to draw a square. | 63 // False positive because a unicode character is used to draw a square. |
62 // If it was actual text it'd be too low-contrast, but a square is fine. | 64 // If it was actual text it'd be too low-contrast, but a square is fine. |
63 this.accessibilityAuditConfig.ignoreSelectors( | 65 this.accessibilityAuditConfig.ignoreSelectors( |
64 'lowContrastElements', '#timeline-view-selection-ul label'); | 66 'lowContrastElements', '#timeline-view-selection-ul label'); |
65 // Suppress this error; the black-on-gray button is readable. | 67 // Suppress this error; the black-on-gray button is readable. |
66 this.accessibilityAuditConfig.ignoreSelectors( | 68 this.accessibilityAuditConfig.ignoreSelectors( |
67 'lowContrastElements', '#export-view-save-log-file'); | 69 'lowContrastElements', '#export-view-save-log-file'); |
68 // False positive because the background color highlights and then | 70 // False positive because the background color highlights and then |
69 // fades out with a transition when there's an error. | 71 // fades out with a transition when there's an error. |
70 this.accessibilityAuditConfig.ignoreSelectors( | 72 this.accessibilityAuditConfig.ignoreSelectors( |
71 'lowContrastElements', '#hsts-view-query-output span'); | 73 'lowContrastElements', '#hsts-view-query-output span'); |
72 // False positives for unknown reason. | 74 // False positives for unknown reason. |
73 this.accessibilityAuditConfig.ignoreSelectors( | 75 this.accessibilityAuditConfig.ignoreSelectors( |
74 'focusableElementNotVisibleAndNotAriaHidden', | 76 'focusableElementNotVisibleAndNotAriaHidden', |
75 '#hsts-view-tab-content *'); | 77 '#hsts-view-tab-content *'); |
76 | 78 |
77 // TODO(aboxhall): enable when this bug is fixed: | 79 // TODO(aboxhall): enable when this bug is fixed: |
78 // https://github.com/GoogleChrome/accessibility-developer-tools/issues/69 | 80 // https://github.com/GoogleChrome/accessibility-developer-tools/issues/69 |
79 this.accessibilityAuditConfig.auditRulesToIgnore.push( | 81 this.accessibilityAuditConfig.auditRulesToIgnore.push( |
80 'focusableElementNotVisibleAndNotAriaHidden'); | 82 'focusableElementNotVisibleAndNotAriaHidden'); |
81 | 83 |
| 84 var controlsWithoutLabelSelectors = [ |
| 85 '#export-view-user-comments', |
| 86 '#hsts-view-add-input', |
| 87 '#hsts-view-delete-input', |
| 88 '#hsts-view-query-input', |
| 89 ]; |
| 90 |
| 91 // Enable when failure is resolved. |
| 92 // AX_TEXT_01: http://crbug.com/559203 |
| 93 this.accessibilityAuditConfig.ignoreSelectors( |
| 94 'controlsWithoutLabel', |
| 95 controlsWithoutLabelSelectors); |
| 96 |
| 97 // Enable when warning is resolved. |
| 98 // AX_HTML_01: http://crbug.com/559204 |
| 99 this.accessibilityAuditConfig.ignoreSelectors( |
| 100 'humanLangMissing', |
| 101 'html'); |
| 102 |
82 // Wrap g_browser.receive around a test function so that assert and expect | 103 // Wrap g_browser.receive around a test function so that assert and expect |
83 // functions can be called from observers. | 104 // functions can be called from observers. |
84 g_browser.receive = | 105 g_browser.receive = |
85 this.continueTest(WhenTestDone.EXPECT, | 106 this.continueTest(WhenTestDone.EXPECT, |
86 BrowserBridge.prototype.receive.bind(g_browser)); | 107 BrowserBridge.prototype.receive.bind(g_browser)); |
87 | 108 |
88 g_browser.setPollInterval(TESTING_POLL_INTERVAL_MS); | 109 g_browser.setPollInterval(TESTING_POLL_INTERVAL_MS); |
89 | 110 |
90 var runTest = this.deferRunTest(WhenTestDone.EXPECT); | 111 var runTest = this.deferRunTest(WhenTestDone.EXPECT); |
91 | 112 |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 ]; | 745 ]; |
725 | 746 |
726 for (var i = 0; i < allIds.length; ++i) { | 747 for (var i = 0; i < allIds.length; ++i) { |
727 var curId = allIds[i]; | 748 var curId = allIds[i]; |
728 expectEquals(nodeId == curId, NetInternalsTest.nodeIsVisible($(curId))); | 749 expectEquals(nodeId == curId, NetInternalsTest.nodeIsVisible($(curId))); |
729 } | 750 } |
730 }; | 751 }; |
731 | 752 |
732 return NetInternalsTest; | 753 return NetInternalsTest; |
733 })(); | 754 })(); |
OLD | NEW |